Boon
Boon

Reputation: 41480

Is there a way to know if a particular git commit to a branch is in another branch as well?

Is there a way to know if the code change for a particular commit on a branch is in another branch as well (whether it be via git cherry-pick or merge)

I have two branches of code and occasionally some commits that goes into one branch should also go into another. How do I find out what commit was done to branch A but not B (and vice versa - what's done to both). Right now I am manually checking the commit changes in both branches.

Upvotes: 1

Views: 112

Answers (1)

torek
torek

Reputation: 488013

The git cherry command will usually do the trick, although it's designed for a slightly different purpose and thus may not be as convenient as you might like.

Read the documentation for git patch-id as well. This should give you some idea of the limitations of this method (in particular if a commit must be modified during cherry-picking, it may look too different afterwards to be found).

Once you have digested both of those (and experimented with them if needed), read the git rev-list documentation and pay attention to the --cherry-mark and --cherry-pick options. Using these with the symmetric difference operator (A...B) will allow you to automate most of what you want here.

Upvotes: 1

Related Questions