背景:每次提交git,都要寫注釋,有些情況注釋不太好寫,或者根本沒有必要寫,這時可以通過自動加注釋方法,比如可以追加修改了哪些文件
解決:通過shell腳本,在腳本里面寫git命令,add commit push 等等,commit時獲取git的status,參照下面腳本。
#!/bin/bash #execute git command note=`git status` git status git add . git commit -am "$note" git pull --rebase git push
通過git log,就能查看剛提交的日志,能看到修改了哪些文件。
當然你想帶的信息都可以加進去,便於后續排查方便,git有根據日志查詢的功能。