2016-05-23 98 views
1

我不想更改實際的提交消息,我想更改輸入提交消息時顯示的註釋文本的模板。在git中添加提交時,是否可以更改提交消息的已評論部分的內容?

例如這樣的:

# Please enter the commit message for your changes. Lines starting 
# with '#' will be ignored, and an empty message aborts the commit. 
# On branch add_mssql 
# Changes to be committed: 
# (use "git reset HEAD <file>..." to unstage) 
# 
#  modified: csv/jobdetails.csv 
# 
# Changes not staged for commit: 
# (use "git add <file>..." to update what will be committed) 
# (use "git checkout -- <file>..." to discard changes in working directory) 
# 
#  modified: db/test.db 
# 
# Untracked files: 
# (use "git add <file>..." to include in what will be committed) 
# 
#  Person.js 
#  README.MD 
#  get_supervisorjobs.js 
#  loadmsqlviews.js 
#  mssql/ 
#  results.html 
#  results.js 
#  supervisorsNpositions.js 
+0

什麼評論文字?你能分享一個例子嗎? – Mureinik

回答

1

改變默認提交消息的另一種方法是安裝一個prepare-commit-msg git鉤子。這允許您提供一個腳本來根據情況以不同的方式修改提交消息(無論是新提交,合併提交還是修改提交等)。

請參閱git hooks --help下的prepare-commit-msg。

相關問題