[petsc-dev] git script for finding "outdated" branches in next

Balay, Satish balay at mcs.anl.gov
Fri Jan 11 17:04:56 CST 2019


I use the following:

alias gitreadytomerge'=git fetch -p && comm -12 <(git branch -r --merged origin/next | sort) <(git branch -r --no-merged origin/master | sort)'
alias gitreadytomergesorted='git fetch && paste <(gitreadytomerge | xargs git show -q --format=format:%aI) <(gitreadytomerge) |sort -n'
alias gitreadytomergeincomplete='git fetch -p && (for i in $(git log origin/master..origin/next --no-merges --format=%H); do git branch -r --contains $i; done | sort | uniq)'

The last one can take a while to process all the commits in next.

Note: they have some corner cases - like listing branches added to next
- and subsequently removed. [or if branch-A is merged to branch-B
and branch-B is merged to next - then branch-A is also listed etc..]

Satish


On Fri, 11 Jan 2019, Smith, Barry F. via petsc-dev wrote:

> 
>    Jed gave me this git script to find branches in next that have not yet been merged to master
> 
> alias gitmasternotupdated="comm -12 <(git branch -r --merged origin/next | grep origin/ | sort) <(git branch -r --no-merged origin/master ) | xargs -n1 git log -1 --format='%Cgreen%ci %C(yellow)%d%Creset %s' --abbrev-commit |  sed 's?origin/[a-z/-]*, ??g' | grep -v '(origin/next)' | cut -b 1-`stty size | cut -d" " -f 2` | sort -u | grep -v Merge" 
> 
> Unfortunately it does not list branches in next that have had additional commits added to them (by someone fixing problems seen in nightly tests) since they were merged to next. Hence they can be "lost" branches that we forget to merge into next again for another round of testing.
> 
>    Could someone cook up a script that captures these branches? That is, it shows branches in next that are not master but have been updated since they were merged into next.
> 
>    Thanks
> 
>     Barry
>  



More information about the petsc-dev mailing list