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

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


Since git 1.7.9 version you can also use git commit --amend --no-edit to get your result.

Note that this will not include metadata from the other commit such as the timestamp which may or may not be important to you.


git commit -C HEAD --amend will do what you want. The -C option takes the metadata from another commit.


Another (silly) possibility is to git commit --amend <<< :wq if you've got vi(m) as $EDITOR.