To re-use a commit’s message verbatim, including authorship and timestamp information, use -C <commit>
:
git commit --amend -C @
Pro Tip: @
is a synonym for HEAD
, the currently checked-out commit.
To reset the date as well, use --date now
; to reset the author too, use --reset-author
:
git commit --amend -C @ --date now
git commit --amend -C @ --reset-author
git commit --amend -C @ --date now --reset-author
If you want to use an existing commit’s message and also want a chance to edit it, use -c <commit>
:
git commit --amend -c @
-c
is compatible with --date
and --reset-author
too:
git commit --amend -c @ --date now
git commit --amend -c @ --reset-author
git commit --amend -c @ --date now --reset-author
Added 2020-05-16: To re-use a commit message after a reset, try using @{1}
:
git commit -C @{1}
If you’re wondering what commit @{1}
refers to, run git reflog
and look for the line near the top containing HEAD@{1}
.