shell - Git批处理脚本
天蓬老师
天蓬老师 2017-04-24 09:11:29
0
3
843

弄了个静态博客,但是每次上传觉得挺麻烦的,git add .,git commit -m '',git push origin gh-pages什么的...麻烦死了...啊对了我是在Windows下..

所以我就想写成一个.bat的批处理脚本试试(blog的话commit log也不用天天写0_0)

结果写到调用Git bash之后就不知道怎么办了,对批处理不是很懂,所以在这里请教下大大们

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(3)
巴扎黑

Method 1:
From here: http://mayecn.com/blog/2013/05/03/multiple-alias/

First execute in git bash:
alias blog='git add .;git commit -m "blog update"';git push origin gh-pages

When you want to update your blog in the future, just do it directly blog


Method 2:
From here: http://stackoverflow.com/questions/7534184/git-alias-multiple-commands-and-parameters

Execute in git bash
git config --global alias.blog '!git add . && git commit -m "blog update" && git push origin gh-pages'

or

Edit the .gitconfig file and add this paragraph:

[alias]
    blog = !git add . && git commit -m 'blog update' && git push origin gh-pages

When you want to update your blog in the future, execute git blog

Ty80

In fact, it is in the git installation directory. Create a git-xxx file and use shell to write that file. Then use

git xxx

It’s ready to run. .

For example, if your requirement is to use git add, git commit, and git push continuously, you can add the "git-acp" file in that directory with the following content

#!/bin/sh
git add .
git commit -am "" 
git push origin gh-pages

Then, in the directory that needs to be called, call

git acp "Commit Message"

That’s it. .

Also, if you don’t use shell, but use python or other programming language, it is also possible. .

迷茫

Sao Nian. Use TortoiseGit. Little turtle. Same as svn. https://code.google.com/p/tortoisegit/

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template