I have to create some code review from unmerged branches.
In finding solutions, let\'s not go to local-branch context problem as this will run on a server; there wil
The repository could be cloned with --mirror which creates a bare repository that can be used as a mirror of the original repository and can be updated with git remote update --prune after which all the tags should be deleted for this feature.
I implement it this way:
1. get a list of branches not merged into master
git branch --no-merged master
2. for each branch get a list of revisions on that branch and not in master branch
git rev-list branch1 --not master --no-merges
If the list is empty, remove the branch from the list of branches
3. for each revision, determine the original branch with
git name-rev --name-only revisionHash1
and match regex for ^([^\~\^]*)([\~\^].*)?$. The first pattern is the branch name, the second is the relative path to the branch.
If the branch name found is not equal to the initial branch, remove revision from the list.
At the end I obtained a list of branches and for each of them a list of commits.
After some more bash research, it can be done all in one line with:
git rev-list --all --not master --no-merges | xargs -L1 git name-rev | grep -oE '[0-9a-f]{40}\s[^\~\^]*'
The result is an output in the form
hash branch
which can be read, parsed, ordered, group or whatever.