Skip to content

Instantly share code, notes, and snippets.

@showaltb
Created August 1, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save showaltb/f706b955599b1de272b9 to your computer and use it in GitHub Desktop.
Save showaltb/f706b955599b1de272b9 to your computer and use it in GitHub Desktop.
Remove a file accidentally added with git commit

If you've created a git commit and accidentally included one or more files you didn't intend to, you can remove those files from the commit and place them back in the "Changed but not updated" or "Untracked files" state. Note: do this only if you have not pushed the commit, since this will rewrite history.

git reset HEAD^ file(s)...
git commit --amend -C HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment