Search code examples
gitgit-branchgit-remotegit-log

Show who last committed to branches on a remote


Our remote repo has a ton of branches (for features and fixes) that have sinced been merged back into the main development. In an effort to clean up the repo, we've asked people to delete branches that are no longer necessary.

Is there a git command to list remote branches and who was the last person to commit to them?


Solution

  • So this lists all branches for original, and then prints out the branch+Author Name/Email for them.

    for br in $(git for-each-ref --format='%(refname)' refs/remotes/origin/
    do
       echo "${br}    $(git show -s --format=\"%an %ae\" ${br})"
    done
    

    I don't think that's what you want to start out with though. You probably would be better off using

    git branch --merged origin/master
    

    Or something similar. Which answer the question of "which branches don't point to unique history and can be deleted".