Skip to content

Instantly share code, notes, and snippets.

@artieziff
Created January 15, 2014 16:54
Show Gist options
  • Save artieziff/8439937 to your computer and use it in GitHub Desktop.
Save artieziff/8439937 to your computer and use it in GitHub Desktop.

GIT

Create local branch

git checkout -b branch_name

List all remote and local branches

git branch -a

Switch branch

git checkout branch_name

Push local branch to remote origin

git push origin branch_name

Merge branch

git merge branch_name

Delete local branch

git branch --delete branch_name

Delete remote branch

git push origin --delete branch_name

Use at your own risk

git reset --hard <the sha1 hash>

Create Tag

git tag -a v1.0 -m 'version 1.0'

Push Tag

git push origin v1.0

Delete tag

git tag -d 12345
git push origin :refs/tags/12345

Merge specific files from another branch

git checkout source_branch <paths>..
# example
git checkout development templates/home.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment