Remove file from last commit
I often accidentally commit a file I don't mean to (primarily due to the muscle memory of typing git add .
). To remove a file from the last commit:
git reset HEAD^1 path/to/file/to/remove
git commit --amend
Simples!
sx
Written by Sam Davies
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#