[英]Git merge not display changes
I have two branches A and B when i do git merge from B to A is does not shows any changes.当我从 B 到 A 进行 git merge 时,我有两个分支 A 和 B 没有显示任何更改。 Even there are multiple changes are there.
即使有多个变化。
But when i do A to B it shows changes.但是当我做 A 到 B 时,它显示了变化。 But my requirement is to merge B to A.
但我的要求是将 B 合并到 A。
You need to commit all needed changes in both branches git add .; git commit -m "message"
您需要在两个分支中提交所有需要的更改
git add .; git commit -m "message"
git add .; git commit -m "message"
. git add .; git commit -m "message"
。 Then you do git checkout A
and git merge B
.然后你做
git checkout A
和git merge B
。
When you do not see changes you have nothing committed to B, even if you have a change committed to A. B is behind in this case and will not merge.当您没有看到更改时,您没有任何内容提交给 B,即使您已提交给 A 的更改。在这种情况下,B 落后并且不会合并。
When you do git checkout B; git merge A
当你做
git checkout B; git merge A
git checkout B; git merge A
and you see changes, then you have something committed to A but not to B, like said above. git checkout B; git merge A
并且您会看到更改,然后您将某些内容提交给 A 但没有提交给 B,如上所述。 I tested this locally and this matches your situation.我在本地对此进行了测试,这与您的情况相符。
One error which comes to mind is when you do a git checkout A; git add .
想到的一个错误是当您执行
git checkout A; git add .
git checkout A; git add .
. . Then all your changes will be in A, when you change to B you have nothing left to commit, so all the changes are already in A.
那么你所有的更改都将在 A 中,当你更改为 B 时,你没有什么可以提交的了,所以所有的更改都已经在 A 中了。
You can test this as follows:您可以按如下方式进行测试:
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.