我无法理解谁us
and them
在这些冲突中git revert
,所以我真的不知道这里发生了什么:
git revert some_commit_hash
Then git status
显示以下冲突:
deleted by them: path/to/file1.h
both modified: path/to/file2.h
deleted by them: path/to/file1.cpp
deleted by them: path/to/test_file1.cpp
added by us: path/to/file3.h
deleted by them: path/to/file4.h
added by us: path/to/file5.h
“我们”是谁? “他们”是谁?
更新:请注意,我要恢复的提交是一个非常大的合并提交。
不重复:
- 因为它没有说明谁是谁
us
and them
: GIT:“被我们删除”的冲突有多危险? https://stackoverflow.com/questions/42174485/git-how-dangerous-is-deleted-by-us-conflict
- 因为它涵盖了
merge
and rebase
但不是revert
,并且 git 经常使用相同的术语来表示opposite取决于操作的事情:根据 Git 的说法,谁是“我们”,谁是“他们”? https://stackoverflow.com/questions/21025314/who-is-us-and-who-is-them-according-to-git
- 因为它没有提到“我们”和“他们”-Git - 恢复恢复、冲突 https://stackoverflow.com/questions/29495708/git-reverting-a-revert-conflicts
发生冲突时,适用于所有情况的规则是:
-
ours
/us
是当前的状态HEAD
(主动提交)
-
theirs
/them
是另一方的状态(正在合并的提交、正在精心挑选/重新调整的提交,或者在您的情况下是您想要恢复的提交的“反向”)
一些额外的说明rebase
(回答@GabrielStaples 的评论):
如果你在my/branch
,然后你跑git rebase other/branch
, git
将检查头提交other/branch
并开始重播顶部的一些提交。
如果发生冲突,因为签出的提交来自other/branch
, ours
将大致代表other/branch
, and theirs
将my/branch
.
这部分与直觉相反”ours
应该是我的更改”,但它符合上面的描述:在冲突时,签出的提交是ours
,另一边(正在重播的提交)是theirs
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)