Last active
November 6, 2015 02:59
-
-
Save stephanie-gredell/17fc02b61a3d29473647 to your computer and use it in GitHub Desktop.
Git Commandline basic
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
# create a new branch | |
git checkout -b branch-name | |
# checkout an existing branch | |
git checkout branch name | |
# pull changes from branch-a into current-branch | |
git checkout branch-a | |
git pull --rebase # get all the latest changes from branch-a | |
git checkout current-branch | |
git rebase branch -a | |
# merge changes from branch to master | |
git checkout master | |
git merge branch-a | |
# quickly switch between two branches | |
# assume that you're doing work between master and branch | |
# instead of this: | |
git checkout master | |
git checkout branch | |
git checkout master | |
git checkout branch | |
# you can switch like this | |
git checkout - | |
# see what branch you're on | |
git status | |
# add all files (tracked and untracked) | |
git add . | |
# pull a commit into current branch | |
# on the branch that the commit you want to pull is on | |
git log # pull up the log and get the commit hash | |
git checkout working-branch # checkout the branch to add this commit to | |
git cherry-pick commithash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment