Skip to content

Instantly share code, notes, and snippets.

@albohlabs
Created March 6, 2012 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save albohlabs/1989320 to your computer and use it in GitHub Desktop.
Save albohlabs/1989320 to your computer and use it in GitHub Desktop.
CLI: git
# Read: pull the changes from origin/master into my current local branch my_branch
git push origin master
# connect your repository to a remote server
git remote add origin <server>
# create a new branch
git checkout -b feature_x
# switch back
git checkout master
# delete
git branch -d feature_x
# push the branch to your remote repository
git push origin <branch>
# update
# (on current branch) git rebasing is taking all your local changes since the last push and put them ahead of other people’s changes regardless of the date you made the commit.
git pull --rebase
# merge another branch into your active branch
git merge <branch>
# show conflicts
git diff <source_branch> <target_branch>
# tags
# 1b2e1d63ff - the first 10 characters of the commit id you want to reference with your tag
git tag 1.0.0 1b2e1d63ff
# log
git log
# replace local changes
# replaces the changes in your working tree with the last content in HEAD
git checkout -- <filename>
# reset local
git fetch origin
git reset --hard origin/master
# gut GUI
gitk
# color
git config color.ui true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment