Create new branch and push to remote
$ git branch name -> create local branch
$ git push origin 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 :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 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 name tags/[tag name]
Update on 08th May 2o12
Delete Branch at Remote:
$ git push origin –delete name
To remove a tag on the remote server:
$ git push origin :refs/tags/[tag name]
Resource:
http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
