Skip to content

Instantly share code, notes, and snippets.

@joejag
Last active December 14, 2015 01:09
Show Gist options
  • Save joejag/5003726 to your computer and use it in GitHub Desktop.
Save joejag/5003726 to your computer and use it in GitHub Desktop.
Git cheatsheet
### PUSH / PULL
# Pull without making merge history commits
git pull --rebase
# Push while squashing related commits
git rebase -i @{u}
git push
### BRANCHES
# List branches
git branch -a
# Checkout with tracking on a remote branch
git checkout -t origin/remote_name
# Delete remote branch
git push origin --delete remote_branch
# Remote branches have been deleted, update your repo to reflect this
git pull -p
# Diff two branches
git diff local_name remote_name
# Merge branches
git checkout branch_to_merge_into
git merge other_branch
# I want this one commit from another branch in this branch, but no others
git cherry-pick f617181
### MERGE CONFLICTS
# You've pulled/merged and there are merge conflicts. View them
git diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment