Git 新建 删除branch

新建Branch

第一步:

查看当前branch 和远程服务器branch
newdeMacBook-Pro-3:cashier PengYanan$ git branch -a
*develop_v1.4.0
develop_v1.4.0_test
remotes/origin/develop_v1.0.0
remotes/origin/develop_v1.1.0
remotes/origin/develop_v1.2.0
remotes/origin/develop_v1.3.0
remotes/origin/develop_v1.4.0
remotes/origin/develop_v1.4.0_test
remotes/origin/master

当前branch 为* xxxxx

第二步:

git log <branchName> 查看commit历史

commit e51667bc36de19c3043d109c45e65611ba5bc9e6
Author: **
Date: Mon Jan 18 16:38:04 2016 +0800
fix bug#000111

第三步:

git checkout -b <new branch name> e51667bc36de19c3043d109c45e65611ba5bc9e6

This will create the new branch and check it out.

git push <remote-name> <new branch name>

删除branch

To delete a local branch/tag

git branch -d the_local_branch
git tag -d the_local_tag

To remove a remote branch

git push origin :the_remote_branch
git push origin --delete the_remote_branch

To remove a remote tag

git push origin :refs/tags/the_remote_tag
git push origin --delete tag the_remote_tag

参考
http://stackoverflow.com/questions/1519006/how-do-you-create-a-remote-git-branch/
http://stackoverflow.com/questions/7167645/how-do-i-create-a-new-git-branch-from-an-old-commit