Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jul 112013

Rewriting last Git commit


Sometimes, when you regret your last commit and before it is pushed to remote, it is easy with the following commands:

git add file1.txt file2.txt
git commit -m 'Add some files'

# Now you regret to include file2.txt
git rm file2.txt
git commit --amend # Edit the commit message in the editor

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>