微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在重新设置基准期间如何从主服务器中选择文件版本?

如何解决在重新设置基准期间如何从主服务器中选择文件版本?

我通过更新后的母版启动分支的基础。重新设置期间,有一些冲突的文件很容易解决。但是,一个文件一个巨大的标头,其中包含数百个宏定义,所有这些定义都有冲突。

我只想从母版中选择文件版本,而无需编辑当前带有冲突标记文件

如何做到这一点而又不丧失我已经对其他文件所做的冲突解决方案?

选项将使用命令行或TortoiseGit。

解决方法

考虑到您正在与master进行基础合作。您可以从master分支中检出特定文件,这将覆盖本地副本。

git checkout --theirs my/file.js

(在这里-他们告诉git从我们要重新设置基准的分支中获取文件)

,

您可能需要考虑手动转移分支中引入的更改。假设您的分支是X,那么您可以这样做:

git checkout HEAD -- the-file # have the file exactly as it is in the base branch of the rebase
# now,**manually**,check the differences between "the common ancestor",# which in a rebase it has a different meaning,and what is being rebased:
git diff HEAD~ REBASE_HEAD -- the-file
# find a way to have the file as it is in your working tree to include those changes that the diff is showing
# when you are done:
git add the-file
git rebase --continue

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。