git - How can I see what physical hunks are not in one branch from another? -


there branch topic1 branched master. let's original owner of topic1 didn't proper merge of branch master, , instead did cherry pick operation missed few commits.

months pass, , realize topic1 still there. @ point, it's been long have no reliable way determine if cumulative patch topic1 represents present on master.

what want able git diff topic1..master hide hunks on master not exist in topic1. want see portion of diff showing changes in topic1 not present in master. possible? , if so, how can it?

i'm using git 2.8+

you can start using --cherry-pick option of git log list of commits topic1 not cherry-picked master.

from documenation of git-log:

--cherry-pick
omit commit introduces same change commit on “other side” when set of commits limited symmetric difference.

what's interesting here --cherry-pick option uses commit's diff – not commit's sha-1 hash – in order determine whether commit introduces same set of changes present in branch.

from documentation of git-cherry, related:

the equivalence test based on diff, after removing whitespace , line numbers. git-cherry therefore detects when commits have been "copied" means of git-cherry-pick, git-am or git-rebase.

such commits said patch equivalent.

so, git log --cherry-pick master...topic1 exclude commits topic1 have been cherry-picked in master, leaving ones not. add --right-only option indicate interested in seeing commits right side of range, i.e. topic1:

git log --cherry-pick --right-only master...topic1 

we might want exclude merge commits selection, add --no-merges option:

git log --no-merges --cherry-pick --right-only master...topic1 

lastly, add --patch option diff commits. final command becomes:

git log --patch --no-merges --cherry-pick --right-only master...topic1 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -