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 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/13041058.html
未经授权禁止转载,违者必究!