Git修改已經提交的註釋或日誌

轉自:http://www.cnblogs.com/tocy/p/git_commit_log_modify.htmlhtml

對於已經修改提交過的註釋,若是須要修改,能夠藉助 git commit --amend 來進行。(注意:修改日誌的功能在svn中須要server支持,在git中能夠獨立修改)
注意:必須是最近提交,尚未push的註釋。c++

例如,在base 裏最新的提交就是 resolving the crash problem,如今須要將其改成resolving the crash problem to fix bug xxx
在base目錄下,輸入 git commit --amend,就會進入一個文本編輯界面(以下),在註釋的地方修改 ,保存而後退出,這樣註釋就修改了,再從新 push.git

resolving the crash problem

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date:      Sat Dec 12 08:44:59 2015 +0800
#
# On branch master
# Your branch and 'origin/master' have diverged,
# and have 1 and 1 different commit each, respectively.
#   (use "git pull" to merge the remote branch into yours)
#
# Changes to be committed:
#       modified:   c_c++/1-c-invoke-cpp-main.c
#       modified:   c_c++/1-c-invoke-cpp.cpp
#

注意以上界面使用vi操做習慣。web

相關文章
相關標籤/搜索