84669 人學習
152542 人學習
20005 人學習
5487 人學習
7821 人學習
359900 人學習
3350 人學習
180660 人學習
48569 人學習
18603 人學習
40936 人學習
1549 人學習
1183 人學習
32909 人學習
弄了个静态博客,但是每次上传觉得挺麻烦的,git add .,git commit -m '',git push origin gh-pages什么的...麻烦死了...啊对了我是在Windows下..
git add .
git commit -m ''
git push origin gh-pages
所以我就想写成一个.bat的批处理脚本试试(blog的话commit log也不用天天写0_0)
.bat
结果写到调用Git bash之后就不知道怎么办了,对批处理不是很懂,所以在这里请教下大大们
Git bash
欢迎选择我的课程,让我们一起见证您的进步~~
方法1: 來自這裡: http://mayecn.com/blog/2013/05/03/multiple-alias/
先在 git bash 執行:alias blog='git add .;git commit -m "blog update"';git push origin gh-pages
alias blog='git add .;git commit -m "blog update"';git push origin gh-pages
以後要更新部落格時,直接執行 blog
blog
方法2: 來自這裡: http://stackoverflow.com/questions/7534184/git-alias-multiple-commands-and-parameters
在 git bash 執行git config --global alias.blog '!git add . && git commit -m "blog update" && git push origin gh-pages'
git config --global alias.blog '!git add . && git commit -m "blog update" && git push origin gh-pages'
或
編輯 .gitconfig 文件,加上這麼一段:
[alias] blog = !git add . && git commit -m 'blog update' && git push origin gh-pages
以後要更新部落格時,執行 git blog
git blog
其實,在git的安裝目錄下。建立一個git-xxx文件,用shell去寫那個文件。然後使用
git xxx
就可以運行了。 。
例如,你的需求是連續使用git add, git commit, git push, 可以在那個目錄裡,加上"git-acp"文件,內容如下
#!/bin/sh git add . git commit -am "" git push origin gh-pages
然後,在需要呼叫的目錄裡,呼叫
git acp "Commit Message"
就可以了。 。
而且,如果你不用shell,而是用python或其他程式語言,也是可以的。 。
騷年。有TortoiseGit用啊。小烏龜啊。跟svn一樣一樣的。 https://code.google.com/p/tortoisegit/
方法1:
來自這裡: http://mayecn.com/blog/2013/05/03/multiple-alias/
先在 git bash 執行:
alias blog='git add .;git commit -m "blog update"';git push origin gh-pages
以後要更新部落格時,直接執行
blog
方法2:
來自這裡: http://stackoverflow.com/questions/7534184/git-alias-multiple-commands-and-parameters
在 git bash 執行
git config --global alias.blog '!git add . && git commit -m "blog update" && git push origin gh-pages'
或
編輯 .gitconfig 文件,加上這麼一段:
以後要更新部落格時,執行
git blog
其實,在git的安裝目錄下。建立一個git-xxx文件,用shell去寫那個文件。然後使用
就可以運行了。 。
例如,你的需求是連續使用git add, git commit, git push, 可以在那個目錄裡,加上"git-acp"文件,內容如下
然後,在需要呼叫的目錄裡,呼叫
就可以了。 。
而且,如果你不用shell,而是用python或其他程式語言,也是可以的。 。
騷年。有TortoiseGit用啊。小烏龜啊。跟svn一樣一樣的。 https://code.google.com/p/tortoisegit/