Linux command
git-create-branch 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Create and switch to branch
git create-branch [branch_name]
Create and switch to branch from a specific starting point
git create-branch [name] [start_point]
Create and push to remote
git create-branch -r [name]
说明
git create-branch is a convenience command from git-extras that simplifies branch creation workflows. It creates a new branch and switches to it. With the -r flag, it additionally pushes the branch to origin and sets up remote tracking, combining several manual steps into one command. Without the -r flag, the command creates a local branch and switches to it, equivalent to git checkout -b. You can optionally specify a starting point (commit hash or branch name); otherwise, the branch starts from HEAD.
参数
- -r, --remote
- Setup a remote tracking branch as well. Creates the branch locally, pushes it to origin, and sets up tracking.
FAQ
What is the git-create-branch command used for?
git create-branch is a convenience command from git-extras that simplifies branch creation workflows. It creates a new branch and switches to it. With the -r flag, it additionally pushes the branch to origin and sets up remote tracking, combining several manual steps into one command. Without the -r flag, the command creates a local branch and switches to it, equivalent to git checkout -b. You can optionally specify a starting point (commit hash or branch name); otherwise, the branch starts from HEAD.
How do I run a basic git-create-branch example?
Run `git create-branch [branch_name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -r, --remote do in git-create-branch?
Setup a remote tracking branch as well. Creates the branch locally, pushes it to origin, and sets up tracking.