Change last commit
Oh no ! I just committed, providing a wrong message.
No problemo, you can just edit the log of the last commit:
git commit --amend -m "A better description"
Oh no! I forgot that file.
git add file
git commit --amend -m "blah"
Oh no! I forgot that file... but the message's good.
git add file
git commit --amend -C HEAD
Oh no! I forgot to git add ....
vim file
git commit --amend -aC HEAD
Thanks passcod for the update ! ;)
Written by YDB
Related protips
2 Responses
Additional scenarios:
"Oh no! I forgot that file."
git add file
git commit --amend -m "blah"
"Oh no! I forgot that file... but the message's good."
git add file
git commit --amend -C HEAD
"Oh no! I forgot one last edit before committing everything."
$EDITOR file
git commit --amend -aC HEAD
I use that last one a lot.
over 1 year ago
·
Thanks ! Very usefull.
I updated the protip ;)
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#