Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.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,我有两个分支A和B,当我进行git合并时,从B到A的合并不会显示任何更改。即使有多个变化也存在 但当我做A到B时,它显示出变化。但我的要求是将B合并到A。您需要提交两个分支中所需的所有更改git add。;git commit-m“message”。然后执行git签出A和git合并B 当您没有看到更改时,即使您有一个更改提交给a,您也没有提交给B。在这种情况下,B是落后的,不会合并 当你做git签出B;git merge A,您看到了更改,然后您将某些内容提交给A,但不提交给B,如上所述。我在本

我有两个分支A和B,当我进行git合并时,从B到A的合并不会显示任何更改。即使有多个变化也存在


但当我做A到B时,它显示出变化。但我的要求是将B合并到A。

您需要提交两个分支中所需的所有更改
git add。;git commit-m“message”
。然后执行
git签出A
git合并B

当您没有看到更改时,即使您有一个更改提交给a,您也没有提交给B。在这种情况下,B是落后的,不会合并

当你做
git签出B;git merge A
,您看到了更改,然后您将某些内容提交给A,但不提交给B,如上所述。我在本地测试过,这符合你的情况

我想到的一个错误是,当您执行
git签出时;git add.
。那么你所有的更改都将在A中,当你更改为B时,你没有任何东西可以提交,所以所有的更改都已经在A中了

您可以按如下方式进行测试:

mkdir gittest
cd gittest    
git init                            
touch readme
git add .
git commit -m "init"
git branch A                                  
git branch B
git checkout A
touch a     
git add a     
git commit -m "a"
git merge B # does not work
git checkout B   
git merge A # does work
touch b          
git add b  
git commit -m "b"
git checkout A   
git merge B # does work now

您能否提供有关两个分支之间的确切关系的更多详细信息,例如,通过提供一个相关提交的缩短的
git log--all--decoration--oneline--graph