前言
使用Git的過程中,有時候需要經常和頻繁的提交操作,每次都要add,commit,pull,push,正常開發中我們不是每次都需要關心這中間都修改了什麼文件,那就用一個命令一鍵提交吧。
Git Bash
-
新建一個 .sh 文件,比如 git push.sh
-
now=$(date "+%Y-%m-%d") echo "Change Directory to D:/Code" cd D:/Code echo "Starting add-commit-pull-push..." git add -A && git commit -m "$now" && git pull && git push echo "Finish!" read
注意事項
-
如何你連命令窗口都不想保留,那就把最後那個 read 拿掉就好了。
-
如果你想每次輸入commit文字,那就把 now 這個變量設置成 read 變量
read -p "please input commit comments:" msg git commit -m "$msg"
具體位置靈活變通下