Skip to content

Instantly share code, notes, and snippets.

@johngan
Last active November 3, 2016 07:14
Show Gist options
  • Select an option

  • Save johngan/d70afa7408f8bcf6aff1f06ef860e909 to your computer and use it in GitHub Desktop.

Select an option

Save johngan/d70afa7408f8bcf6aff1f06ef860e909 to your computer and use it in GitHub Desktop.
Git Cheatsheet

Git-Cheatsheet

###Add existing Repository to Git

git init
git add .
git commit -m "Initial commit"
git remote add origin <project url>
git push -u origin master

###See what tracking branches you have set up

$ git branch -vv

###Delete remote branch

$ git push origin --delete <branchName>

###If you already have a local branch and want to set it to a remote branch

$ git branch -u origin/branch-name

Create branch and checkout

$ git checkout -b test

Return to head of a branch

git checkout <branchName>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment