Create new branch and push to remote
$ git branch [branch name] -> create local branch
$ git push origin [branch name] -> push local branch to remote

pulling code from a remote branch and create a new local branch
$ git checkout -b [local branch name] [remote branch name]

delete remote branch
$ git push origin :[branch name]

list branch in remote repo
$ git branch -r

Switch to a master branch
$ git checkout master

merging code from other branch to master (–no-ff is to always create commit object to avoid losing
info about historical existence of another branch and groups together all commits
$ git merge –no-ff [other branch name]

delete local branch
$ git branch -d [branch name]

tag a commit for future reference (can be used for the purpose of versioning)
$ git tag -a [tag name] -m “[some description]“

To see how many commits created since the last tag or given tag
$ git describe –tags

push all tags to remote
$ git push –tags

push one tag to remote
$ git push origin [tag name]

list existing tags
$ git tag -l

checkout a tagged revision and create a branch
$ git checkout -b [branch name] tags/[tag name]

 

Advertisement