EM0
EM0

Reputation: 6337

How to tell the last commit of a given git branch merged into another branch to find changes made on the branch?

Suppose I have a feature_x git branch created from the master branch. I want to review the changes made on feature_x, in other words - what changes would be made to master if feature_x was to be merged into it now?

This is exactly what GitHub pull requests show, but I want to see the difference in Git Extensions without creating a pull request. The latest version of Git Extensions (2.49) has a very useful "compare branches" feature, which does exactly this.

The only problem is that if I compare to the latest commit on master this includes other changes made to master since it was last merged into feature_x. So instead of the latest commit on master I want to use the last commit that was merged into feature_x as the basis for comparison. How do can I find it, easily and reliably (preferably in Git Extensions, but a git command would do)?

Upvotes: 1

Views: 586

Answers (2)

EM0
EM0

Reputation: 6337

It turns out that the Git Extensions Diff has a "Compare to merge base" checkbox, which does exactly what I want, but it wasn't obvious before, because feature_x was my BASE, so checking it didn't produce a meaningful result.

If I'm currently on the master branch and I select a commit on the feature_x branch and select Compare, Compare with current branch I then need to swap the branches in the Diff dialog (so master is the BASE) and check "Compare to merge base".

Upvotes: 0

Vampire
Vampire

Reputation: 38734

git diff master...feature_x

This will do exactly what you want, showing a diff of the changes that are in feature_x but not in master. Be aware that there are three dots intentionally. With two dots you would compare the latest master vs. the latest feature_x.

Upvotes: 2

Related Questions