Re: Interdiff between amended commits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stefan Haller venit, vidit, dixit 13.04.2011 13:54:
> I'd like to show an interdiff between two commits, e.g. when a commit
> was amended.
> 
> I'm aware of the "intercommit" alias in the git wiki:
> 
>   $ git show commit1 > .git/commit1 && git show commit2 > .git/commit2 && interdiff .git/commit[12]
> 

This basically computes the diff between two patches, using a tool which
groks the patch format.

> It only works for simple cases though, and I'd also like to avoid the
> dependency to an external tool if possible.

You could use git diff --no-index instead, so that would work in really
simple cases only, probably.

> 
> So one thing I came up with is this:
> 
>   git checkout commit1^
>   git cherry-pick --no-commit commit2
>   git diff --cached

That does something completely different. It compares the tree of
commit1^ with the tree of (commit1^ with commit2's patch applied). I
don't see how commit1's patch plays any role here.

Depending on what your actual use case, you may be happier with "git
diff commit1 commit2". Alternatively, you may produce a fake merge with
parents commit1 and commit2 and tree commit1^ and look at "show -R -c"
for that. Sounds weird, I know ;)

Michael

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]