Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在git中为分支创建分支?_Git_Github - Fatal编程技术网

如何在git中为分支创建分支?

如何在git中为分支创建分支?,git,github,Git,Github,我的主分支有一个分支xyz。我想为分支创建一个新分支xyz。我该怎么做 分支始终是从当前分支创建的。换句话说,这里没有什么特别的,只需git checkout-b xyz branch,而在xyz上创建分支的主要方法是: git branch <name> [start-point] git checkout -b <name> [start-point] git分支[起点] git签出-b[起点] 第一个只创建一个分支,而第二个创建并签出它。如果提供了起始点(例如主

我的主分支有一个分支
xyz
。我想为分支创建一个新分支
xyz
。我该怎么做

分支始终是从当前分支创建的。换句话说,这里没有什么特别的,只需
git checkout-b xyz branch
,而在
xyz

上创建分支的主要方法是:

git branch <name> [start-point]
git checkout -b <name> [start-point]
git分支[起点]
git签出-b[起点]
第一个只创建一个分支,而第二个创建并签出它。如果提供了起始点(例如主节点),则在该点创建分支。如果不是,则在您当前签出的任何位置创建


在这两种情况下,它实际上是指提交;创建的分支之间没有关联。也就是说,
git branch xyz master
不会创建“for”master的分支,它只是在提交master当前所在的位置创建一个分支。如果你从未将一个分支合并到另一个分支中,它们将永远不会相互了解。

推荐阅读:专业Git书籍:它真的很好。Thanx对于这个解释
就是说,Git branch xyz master不会创建“for”master分支,它只会在commit master当前的位置创建一个分支。
git branch new-branch-name-you-want xyz