Skip to content

Instantly share code, notes, and snippets.

@boywijnmaalen
Last active November 5, 2018 10:55
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 boywijnmaalen/46715f247a078bcf73210d83ac753883 to your computer and use it in GitHub Desktop.
Save boywijnmaalen/46715f247a078bcf73210d83ac753883 to your computer and use it in GitHub Desktop.
# Method #1 - revert the file and create a new commit (safe method)
$ git checkout HEAD^ -- /path/to/file
$ git add /path/to/file
$ git commit -m "revert changes on this file, not finished with it yet"
$ git push origin HEAD
# Method #2 - revert the file and update the last commit ('uncommitting' method)
# use this method only if you know what you're doing
$ git checkout HEAD^ -- /path/to/file
$ git commit --amend
$ git push -f origin HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment