Last active
February 17, 2017 09:40
-
-
Save jorgeas80/49e00fbfeb859027bed7003373b5ddfa to your computer and use it in GitHub Desktop.
Some useful git commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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