我想从上游回购的分支中提取更改。我已经使用以下命令设置了上游回购:
git remote add upstream http://URL-of-master-repo.git 然后,我尝试使用以下命令提取更改
git checkout my-local-branch
git fetch upstream remote-branch
git merge upstream/remote-branch但是文件仍然没有出现在我的磁盘上,但是我得到了一个冲突:
Auto-merging minimal-build-config.cmake
CONFLICT (content): Merge conflict in minimal-build-config.cmake
Automatic merge failed; fix conflicts and then commit the result.如何正确解决冲突,以便能够从上游分支获取文件?
发布于 2018-10-25 12:06:56
一个好的做法是拥有这样的结构,它看起来像你做的,但为了澄清的目的进行解释是很好的:
origin https://github.com/your-username/forked-repository.git (fetch)
origin https://github.com/your-username/forked-repository.git (push)
upstream https://github.com/original-owner-username/original-repository.git (fetch)
upstream https://github.com/original-owner-username/original-repository.git (push)因此,origin是您的分支,而upstream是原始存储库。然后使用
git fetch upstream你会得到下面的输出
From https://github.com/original-owner-username/original-repository
* [new branch] master -> upstream/master其中现在有一个名为upstream/master的分支,用于跟踪原始存储库。
然后结帐到您的本地分支并合并
git checkout master
git merge upstream/master如果您有冲突(看起来是这样),修复它们并提交更改。
https://stackoverflow.com/questions/52981111
复制相似问题