Skip to content

Instantly share code, notes, and snippets.

@crispgm
Forked from 0x8BADFOOD/remove_file_from_last_commit
Last active December 31, 2019 02:53
Show Gist options
  • Save crispgm/1058b9efb74463577855e5b8345e5b32 to your computer and use it in GitHub Desktop.
Save crispgm/1058b9efb74463577855e5b8345e5b32 to your computer and use it in GitHub Desktop.
[Git] Remove file from last commit
# 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