首页 > 解决方案 > git diff between head of branch and tail of branch

问题描述

I'm about to take over work on a git branch that was started by someone else on my team. He had to make quite a few changes, and I'm also going to have to make quite a few changes. This will all be happening while other devs are merging smaller changes to the target branch.

Before I start making my changes on this branch, I want to record in a diff file all the changes that were made in this branch. That is like HEAD vs. TAIL, but I don't know how to do that.

I've seen ways to compare head against the "first" commit, but that's not quite what I need. I believe also that comparing HEAD against the target branch wouldn't be right, because that would be HEAD of that branch, not the commit my branch was branched from.

标签: git

解决方案


这是从https://stackoverflow.com/a/28193089/2793683获取的,但是您可以简单地在要比较的两个更改集上放置一个标签,然后使用以下内容:

git diff tag1..tag2 > mypatch.patch

推荐阅读