Created
June 24, 2016 10:02
-
-
Save ejimz/d868dc06e6c7d3e8f653e2ce9f4098e8 to your computer and use it in GitHub Desktop.
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
# undo local chamges | |
git reset --hard | |
#get all remote branchs | |
git fetch origin | |
# back to a specific commit in remote | |
# git reset --hard COMMIT_TO_POINT | |
git reset --hard c330b3fef40794f274402e7c949b228754cc336f | |
push -f | |
# undo local changes but this leaves all your changed files "Changes to be committed" | |
git reset --soft | |
# Merge changes from a fork to master | |
git checkout master | |
git merge userforked-master | |
git push origin master | |
git submodule foreach git pull origin master | |
# get submodules | |
git submodule init | |
git submodule update --recursive | |
# checkout to latest submodules commit | |
git submodule foreach git pull origin master | |
# add a new submodule | |
#first add the module url and path to .gitmodules file | |
git submodule add <url> <path> | |
# Merging dev branch into master branch | |
git checkout master | |
git merge dev | |
#Delete branch remotelly and locally | |
git push origin --delete <branchname> | |
git pull | |
# Get commit count sorted by user | |
git shortlog -s -n | |
# copy just a commit from a branch to other. 123412341234 is the commit-ish | |
git checkout master | |
git cherry-pick 12341234134 | |
#checkout a branch even if a file or directory has the same name | |
git checkout branchname -- | |
#checkout a file even if the branch has the same name | |
git checkout -- filename |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment