I've just performed a commit, but now I see that an additional file, which I've just untracked via git rm --cached myfile.txt
, should also be included in that commit. How do I do this? Do I need to reset that last commit and perform it again? Or is there a way do include this file change into the existing commit?
Asked
Active
Viewed 50 times
0

Šime Vidas
- 182,163
- 62
- 281
- 385
1 Answers
4
git commit --amend
is what you're looking for. Stage your changes, then do git commit --amend
to combine them with the last commit. You shouldn't do this, though, if you've already pushed the original changes up to somewhere other developers would have them.
https://www.atlassian.com/git/tutorials/rewriting-history/git-commit--amend

ceejayoz
- 176,543
- 40
- 303
- 368
-
1More about `git commit --amend`: http://stackoverflow.com/questions/26050327/how-does-git-commit-amend-work-exactly/26050416#26050416 – jub0bs Sep 27 '14 at 13:51