Forked from 0x8BADFOOD/remove_file_from_last_commit
Last active
December 31, 2019 02:53
-
-
Save crispgm/1058b9efb74463577855e5b8345e5b32 to your computer and use it in GitHub Desktop.
[Git] Remove file from last commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# roll back commit | |
git reset --soft HEAD^ | |
# remove file from index | |
git reset HEAD path/to/unwanted_file | |
# commit again without unwanted files | |
git commit -m "My commit message" | |
# Source: http://stackoverflow.com/questions/12481639/remove-files-from-git-commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment