How to Remove Files from a Previous Git Commit
Posted:
Tuesday, August 11th, 2015Last modified:
Tuesday, August 11th, 2015Topics:
GitIf you have accidentally staged and committed files did you did not intend to, perhaps using git commit -a, and you have not pushed them to a shared repo, you can undo that like so...
# Reset to HEAD - 1 commit git reset --soft HEAD~1 # Remove the file(s) you do not want to include in this commit. git reset HEAD path/to/unwanted_file # Commit the files still staged. git commit -m "Commit message does this."
References
Available Wiki Topics
The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.