Skip to content

Instantly share code, notes, and snippets.

@thombergs
Last active December 4, 2016 17:14
Show Gist options
  • Select an option

  • Save thombergs/950a1b0cde7383e73b3ee3c6d3920178 to your computer and use it in GitHub Desktop.

Select an option

Save thombergs/950a1b0cde7383e73b3ee3c6d3920178 to your computer and use it in GitHub Desktop.
Git Cheat Sheet
# clone the remote repo into a (automatically created) folder named like the repo
git clone <FORK_URL>
# list all registered remote repositories
git remote -v
# add the original repo as remote and name it "upstream"
git remote add upstream <ORIGINAL_URL>
# fetch the current state from the upstream remote
git fetch upstream
# change to local master
git checkout master
# merge all updates from upstream master branch into the local branch
git merge upstream/master
# push changes to remote fork
git push
# create a new branch
git checkout -b <BRANCH_NAME>
# push branch to a remote
git push <REMOTE_NAME> <BRANCH_NAME>
# list all local branches
git branch -v
# delete remote branch
git push origin --delete <BRANCH_NAME>
# delete local branch
git branch -d <BRANCH_NAME>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment