使用 git 的開發者大部分都知道如果要修正上一次的 commit message 只要執行
git commit --amend
就可以了,但是如果是不小心漏掉某些需要一併 commit 的檔案,也可以透過 git commit --amend
將檔案補進去。git add file-1 file-2
git commit --amend -m 'New commit message'
如果不修改 commit message,可以增加 --no-edit
參數:
git commit --amend --no-edit
Reference: 学会这两件事,让你成为 Git 老司机 – 文章 – 伯乐在线