How to amend a commit without changing commit message (reusing the previous one)?

前端 未结 6 1696
醉梦人生
醉梦人生 2020-11-27 08:52

Is there a way to amend a commit without vi (or your $EDITOR) popping up with the option to modify your commit message, but simply reusing the prev

6条回答
  •  死守一世寂寞
    2020-11-27 09:43

    just to add some clarity, you need to stage changes with git add, then amend last commit:

    git add /path/to/modified/files
    git commit --amend --no-edit
    

    This is especially useful for when you forgot to some changes in last commit or when you want to add more changes without creating new commits by reusing the last commit

提交回复
热议问题