When using git, is there a way to show commits made to a branch, while ignoring all commits that were brought in by merging?
I'm trying to review the code changes made on a branch while ignoring the ones we made on other branches that were merged in. I know it's damn near impossible to show a diff in that fashion, but I'd like to be able to find out which commits I need to review.
A very hackish way:
git log --graph --oneline --no-merges thebranch|grep '^\*'
--no-merges
Both parents have equal weight in many contexts in git. If you've always been consistent in merging other changes in then you may find that this gives you what you want.
Otherwise you may be able to exclude commits from other named branches.
If you want to review the changes that you are going to merge back into a principal branch then the easiest thing to do is to perform the merge on a local clone and then just look at the diff with the first parent before publishing the merge.
You can use
git cherry
for that, it will find you commits that were not yet merged to the upstream, or commits that are on one branch but not the other. So given two branches named "your-branch" and "master":will present you list of commits compared with their patch id:
You can notice that commits prefixed by "-" are the ones that appear in both branches, whereas those prefixed with "+" are availble only on your branch.
As an alternative you can use:
which will show you list of commits done on "your-branch" that are not yet present on "master"