git - 我怎样才能 git pull --rebase 但进行所有远程更改?

标签 git

我执行了 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/

相关文章:

GitHub 存储库比 GitHub 本身更旧?

git - 本地存储库作为子模块

具有多个命令和参数的 Git 别名

git - 重新定位子模块

git - 如何查找与特定 blob 关联的文件?

ruby-on-rails - 如何使用 Git 分支和 Rails 迁移

git - 'TortoiseSVN --> Show log --> Revert to this revision' 的 TortoiseGit 等价物

git difftool : how to compare zip files

git - 使用 "tag"标记标记 git 提交

git - 将具有历史记录的 git 存储库导出到另一个存储库