Skip to content

Instantly share code, notes, and snippets.

@jorgeas80
Last active February 17, 2017 09:40
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 jorgeas80/49e00fbfeb859027bed7003373b5ddfa to your computer and use it in GitHub Desktop.
Save jorgeas80/49e00fbfeb859027bed7003373b5ddfa to your computer and use it in GitHub Desktop.
Some useful git commands
# Go back to the previous commit version of a file
```git checkout -- /path/to/file```
# Go back to the previous commit version of everything
```git reset --hard HEAD```
# Revert the last PUSHED commit and make a new one to amend the changes
```git revert HEAD```
# Reset the last PUSHED commit and detach our working copy from the last commit
```git reset --hard HEAD~1```
# Diff file between 2 branches
```git diff branch1^..branch2 -- file```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment