Amend files to a git commit without changing the commit message
Quiet often there is the need to add files to the recent commit. This can be done with 2 simple commands.
git add file git commit --amend
In case you do not wand to change the commit message there is the new option --no-edit
for git commit introduced in git 1.7.9. The git release notes describe how the --no-edit
option can be used.
“
git commit --amend
” learned “--no-edit
” option to say that the
user is amending the tree being recorded, without updating the
commit log message.
git commit --amend --no-edit
Of course, I added an alias for the new option to my global git configuration.
ci = commit cm = commit -m ca = commit --amend cn = commit --amend --no-edit
Hello,
It was very helpful, this had help from resetting my project just because I forgot to update .gitignore.
Beladel ilyes Abdelrazak
19 Mar 14 at 13:03 edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
I am using –amend not -am.
weblogger
10 Apr 16 at 18:48 edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>