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
为什么git会选择尚未合并的更改?_Git_Bitbucket - Fatal编程技术网

为什么git会选择尚未合并的更改?

为什么git会选择尚未合并的更改?,git,bitbucket,Git,Bitbucket,在我的布兰卡: git add -u git commit -m "fix weird issue" git push origin origin/BranchA 在bitbucket中: 创建新分支,从主分支 在命令提示符中: git fetch git checkout -b origin/BranchB git pull -u origin origin/BranchB //Updating 3 files, fast forward... git status // everythin

在我的布兰卡:

git add -u
git commit -m "fix weird issue"
git push origin origin/BranchA
在bitbucket中: 创建新分支,从主分支

在命令提示符中:

git fetch
git checkout -b origin/BranchB
git pull -u origin origin/BranchB
//Updating 3 files, fast forward...
git status
// everything is clean

3个文件在本地显示,即使BranchA尚未合并到master。为什么?

更好的顺序是:

git add -u
git commit -m "fix weird issue"
git push -u origin branchA

git fetch
git checkout -b branchB origin/branchB

无需最后拉取

假设您在
BranchA
上并且没有切换分支,
git pull-u origin origin/BranchB
origin
远程获取
origin/BranchB
,并将该分支合并到当前分支,
BranchA
。由于
BranchB
master
指向相同的提交,您现在在
BranchA
中有了“
master
内容”。你是有意的吗?还有,当我签出-b origin/BranchB时,您为什么在
git pull
中使用
-u
标志?@Jubobs我切换到BranchB。我做了一个git pull-u来跟踪遥控器的拉/推操作,所以你可以只写
git pull
,但为什么最终拉取BranchA未合并的更改,基本上是我的问题。@doorfly这就是为什么我不做最终拉:我不想合并任何东西,只需基于新的和从源站获取的branchB启动一个本地分支。那么pull实际上进行了合并,包括从master提交到B的分支?即使A的更改尚未合并到master?@doorfly,pull是一个fetch加上一个merge。在这里,您根本不需要拉,因为您已经进行了提取。从master进行合并,包括从其他分支提交?这将是BranchA的Commission进入BranchB的唯一原因。