xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

git branch

git branch

https://git-scm.com/docs/git-branch

$ git branch --help

$ git branch [--color[=<when>] | --no-color] [--show-current]
	[-v [--abbrev=<length> | --no-abbrev]]
	[--column[=<options>] | --no-column] [--sort=<key>]
	[(--merged | --no-merged) [<commit>]]
	[--contains [<commit]] [--no-contains [<commit>]]
	[--points-at <object>] [--format=<format>]
	[(-r | --remotes) | (-a | --all)]
	[--list] [<pattern>…​]
$ git branch [--track | --no-track] [-f] <branchname> [<start-point>]
$ git branch (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>]
$ git branch --unset-upstream [<branchname>]
$ git branch (-m | -M) [<oldbranch>] <newbranch>
$ git branch (-c | -C) [<oldbranch>] <newbranch>
$ git branch (-d | -D) [-r] <branchname>…​
$ git branch --edit-description [<branchname>]

https://www.git-tower.com/learn/git/commands/git-branch

https://www.git-tower.com/learn/git/faq/create-branch

$ git branch <new-branch>

$ git branch <new-branch> <base-branch>

$ git branch <new-branch> f71ac24d

$ git branch <new-branch> v1.2

$ git branch --track <new-branch> origin/<base-branch>
$ git checkout --track origin/<base-branch>

$ git push -u origin <local-branch>


git cli & create remote branch

# Create a new branch and check it out
$ git checkout -b <branch-name>

# The remote branch is automatically created when you push it to the remote server. 
# <remote-name> is typically origin
$ git push <remote-name> <branch-name> 

$ git push <remote-name> <local-branch-name>:<remote-branch-name>

$ git push --set-upstream <remote-name> <local-branch-name> 

# create a new branch & check it out
$ git checkout -b test

# local & remote  with the same name
$ git push origin test

# local & remote with a different name
$ git push origin test:dev

# ❌ delete remote brach bug, if only `:<remote-branch-name>` 
$ git push origin :dev


https://tecadmin.net/how-to-create-a-branch-in-remote-git-repository/

https://stackoverflow.com/questions/1519006/how-do-you-create-a-remote-git-branch

refs



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


posted @ 2020-06-04 10:55  xgqfrms  阅读(126)  评论(4编辑  收藏  举报