git 创建新分支

git 创建新分支 默认是以当前分支为基准
如果想以指定分支为基准,只要在最后加上分支名即可

 git branch [new_branch_name] [old_branch_name]
 #或者
 git checkout -b [new_branch_name] [old_branch_name]
 #对于远程分支也可以用(上面两个应该在已经fetch 过的情况下用):
 git fetch origin [remote_branch]:[local_branch_name]

比如

git branch new_feature origin/master
git checkout -b new_feature origin/master 
git fetch origin master:new_feature

参考:https://stackoverflow.com/questions/1783405/how-do-i-check-out-a-remote-git-branch

猜你喜欢

转载自blog.csdn.net/harryhare/article/details/80111238
今日推荐