我想找到影响或涉及给定文件的所有合并提交.
对于背景,有人在合并时错误地解决了冲突,并且团队几天没有注意到它.在那时,许多其他不相关的合并已经被提交(我们中的一些人更喜欢不使用rebase,或者事情会更简单).我需要找到"坏"合并提交,因此可以检查它以确定还原的其他内容(当然,还要确定并惩罚有罪者).
场景是这样的:
$ echo First > a.txt && git add a.txt && git commit -m 'First commit'
$ git branch branch1
$ echo "Second: main-branch" >> a.txt && git commit -a -m 'Commit on master'
$ git tag a1
$ echo "Third: main" >> a.txt && git commit -a -m 'Other commit on master'
$ git checkout branch1
$ echo "Second: on branch1" >> a.txt && git commit -a -m 'Commit on branch'
$ git tag b1
Run Code Online (Sandbox Code Playgroud)
...所以现在master和branch1中的a.txt发生了冲突的变化.
$ …Run Code Online (Sandbox Code Playgroud)