boywijnmaalen
9/27/2018 - 10:41 AM

Remove file change from last commit


# 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