我执行了 git fetch
,然后执行了 git pull --rebase
。它正在尝试将远程分支的更改 merge 到我的本地分支。并且存在一些 merge 冲突。所以我做了一个 git reset --hard
。
我的问题是,每当发生冲突时,我是否可以请求 git pull 进行远程更改?
最佳答案
我想你想要的是这个:
git pull --rebase -s recursive -X ours
但它不起作用(我使用的是 1.7.0.4),即使联机帮助页上说它应该。我猜这是由于问题 mentioned here 引起的.
相反,您可以使用:
git pull -s recursive -X theirs
它按预期工作,但您将得到一个merge 而不是rebase。
另外 - 在使用 --rebase 时注意“我们的”,而不是“他们的”。来自 git-rebase 联机帮助页:
[CLIP]... a rebase merge works by replaying each commit from the working branch on top of the upstream branch. Because of this, when a merge conflict happens, the side reported as ours is the so-far rebased series, starting with upstream, and theirs is the working branch. In other words, the sides are swapped. ...[CLIP]
关于git - 我怎样才能 git pull --rebase 但进行所有远程更改?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3438311/