I want to list all commits that are only part of a specific branch.
With the following, it lists all the commits from the branch, but also from the parent (master)>
I needed to export log in one line for a specific branch.
So I probably came out with a simpler solution.
When doing git log --pretty=oneline --graph we can see that all commit not done in the current branch are lines starting with |
So a simple grep -v do the job:
git log --pretty=oneline --graph | grep -v "^|"
Of course you can change the pretty parameter if you need other info, as soon as you keep it in one line.
You probably want to remove merge commit too.
As the message start with "Merge branch", pipe another grep -v and you're done.
In my specific ase, the final command was:
git log --pretty="%ad : %an, %s" --graph | grep -v "^|" | grep -v "Merge branch"