Git diff工具与其他人的commit之间的几次提交 [英] Git diff tool over several commits with other's commit inbetween

查看:307
本文介绍了Git diff工具与其他人的commit之间的几次提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个工作流,其中提交的代码需要由其他开发人员进行审查。在简单的情况下,这可以通过git diff oldhash newhash> diff.txt来完成,并将其上传到我们的评论板。

We have a workflow where committed code needs to be reviewed by other devs. In simple cases this can be done with "git diff oldhash newhash > diff.txt" and upload that to our review board.

但有没有办法创建diff通过多次提交并排除由其他人完成的提交。例如,我想创建一个mine1到mine4的区别,但排除Joe的提交:

But is there a way to create a diff over several commits and exclude commits done in between by someone else. For example I want to create diff over mine1 to mine4 but exclude Joe's commit :

mine4
mine3
joe's
mine2
mine1

任何想法如何在命令行git或与其他工具?

Any ideas how to do this in command line git or with some other tool?

编辑:其他人提交的提交影响不同的文件比我的提交,所以在这种情况下,它只是排除其他人所做的更改。 / p>

The commits made by others affect different files than my commits, so in this case it is just about excluding changes made by others.

推荐答案

您可以通过创建一个与cherry-pick结合的新分支来实现此目的:

You could achieve this by creating a new branch combined with cherry-pick:

git checkout -b mine_diffs
git cherry-pick mine1
git cherry-pick mine2
git cherry-pick mine3
git cherry-pick mine4
git diff mine1_ mine4_

完成后,只需删除科。请注意,sha1散列在差异时会有所不同,这是mine1_和mine4_指示的内容。

When you're done, just delete the branch. Note that the sha1 hashes will be different when diffing, which is what mine1_ and mine4_ indicates.

这篇关于Git diff工具与其他人的commit之间的几次提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆