Skip to content

Instantly share code, notes, and snippets.

@mowat27
Last active December 12, 2015 02:49
Show Gist options
  • Save mowat27/4702158 to your computer and use it in GitHub Desktop.
Save mowat27/4702158 to your computer and use it in GitHub Desktop.
Cheat sheet for git

Branches

List remote branches

git branch -a

Checkout a remote branch (from origin)

git checkout -b branch_name origin/branch_name

Push new local branch to origin

# Local and remote branches must have the same name
git push -u origin branch_name 

Delete remote branch

git push origin --delete <branchName>

http://stackoverflow.com/questions/2003505/how-do-i-delete-a-git-branch-both-locally-and-in-github

Clone from a specific remote branch

git clone -b <branch> <remote_repo>

http://stackoverflow.com/questions/1911109/git-clone-a-specific-branch

Delete a remote tag

$ git tag -d v0.1.0
Deleted tag 'v0.1.0' (was 1487f9c)
$ git push origin :refs/tags/v0.1.0
To [email protected]:*********.git
 - [deleted]         v0.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment