Windows 下 git 提交脚本

每次向版本库提交代码的时候都要输入重复的命令,无形中也浪费时间。

git add . git commit -m “” git push ……

不如直接来一个 push.bat 脚本省时省力。

请在第二行换成你的本地工作目录

  1. @echo off
  2. echo "DOCS PUSH BAT"
  3. echo "1. Move to working directory"
  4. E:
  5. cd E:\document\docs
  6. echo "2. Start submitting code to the local repository"
  7. git add *
  8. echo "3. Commit the changes to the local repository"
  9. set now=%date% %time%
  10. echo "Time:" %now%
  11. git commit -m "%now%"
  12. echo "4. Push the changes to the remote git server"
  13. git push
  14. echo "Batch execution complete!"
  15. pause

需要提交时直接双击运行即可。

或者设置为 Windows 定时任务,定时自动执行。