Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 1.42 KB

find_out_who_created_a_branch.md

File metadata and controls

37 lines (26 loc) · 1.42 KB

Find Out Who Created a Branch

Sometimes it is usefull to find out who created a given branch.

Well first pull everything.

The output the branches and creators:

$ git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)'
Thu Dec 5 20:20:54 2019 +0100    jonasbn         refs/heads/master
Thu Dec 5 20:20:54 2019 +0100    jonasbn         refs/remotes/origin/HEAD
Thu Dec 5 20:20:54 2019 +0100    jonasbn         refs/remotes/origin/master

The StackOverflow response (below), which led me to this even uses sorting:

$ git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' --sort=committerdate
Thu Dec 5 20:20:54 2019 +0100    jonasbn         refs/heads/master
Thu Dec 5 20:20:54 2019 +0100    jonasbn         refs/remotes/origin/HEAD
Thu Dec 5 20:20:54 2019 +0100    jonasbn         refs/remotes/origin/master

Not so interesting in this example, but you get the picture.

To get back to the original question, how do I see the author of a specific branch. Use the above in combination with a grep-like tool.

$ git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | ag master
Thu Dec 5 20:20:54 2019 +0100    jonasbn         refs/heads/master
Thu Dec 5 20:20:54 2019 +0100    jonasbn         refs/remotes/origin/master

References