-
-
Save adrianriobo/c9137c1a48ba383a73edcdfe5ead8702 to your computer and use it in GitHub Desktop.
Git cheatsheet
This file contains 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
git remote add upstream https://github.com/USER/repository.git | |
git checkout -b BRANCHNAME | |
git pull upstream pull/ID/head:BRANCHNAME | |
git checkout BRANCHNAME |
This file contains 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
## Pre-requisite: You have to know your last commit message from your deleted branch. | |
git reflog | |
# Search for message in the list | |
# a901eda HEAD@{18}: commit: <last commit message> | |
# Now you have two options, either checkout revision or HEAD | |
git checkout a901eda | |
# Or | |
git checkout HEAD@{18} | |
# Create branch | |
git branch recovered-branch | |
# You may want to push that back to remote | |
git push origin recovered-branch:recovered-branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment