gitterminalbitbucket

git command to display un-merged branches for particular user in master repo


git command to display un-merged branches for particular user in master repo

git branch -a --no-merged master

Used above command but unable to filter with specific user, as unmegred branches volume is 3k need to clean up them..


Solution

  • Assuming "for particular user" means the author or committer of the last commit at the tip, use whatever you want to generate candidate commits and git log to filter and annotate the list:

    git for-each-ref --no-merged=master --format='%(objectname)' refs/heads refs/remotes \
    | git log --no-walk --stdin --pretty='%h %an %d' --author="your name here" # or --committer= and %cn, or whatever.
    

    git log's --no-walk says you don't want histories, you're just after info about specific commits. --stdin says you're generating the list and feeding it in that way, the rest is all as usual.

    edit: staircase wit says "duh, git log can find all the branches and remotes itself."

    git log --no-walk --branches --remotes --pretty='%h %an %d' --author=Jim