I want to find out who created a branch.
I am sort of able to do so with:
git branch -a | xargs -L 1 bash -c \'echo \"$1 `git log --pretty=format:\"%
As far as I know, you may see if you are the creator of a branch only. This is indicated by the first row in .git/ref/heads/<branch>. If it ends with "Created from HEAD" you are the creator.
List remote Git branches by author sorted by committer date:
git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' --sort=committerdate
Adding to DarVar's answer:
git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | sort -k5n -k2M -k3n -k4n | awk '{print $7 $8}'
P.S.: We used AWK to pretty print the author and the remote branch.
Assuming:
master
master
yet git log --format="%ae %an" master..<HERE_COMES_THE_BRANCH_NAME> | tail -1
A branch is nothing but a commit pointer. As such, it doesn't track metadata like "who created me." See for yourself. Try cat .git/refs/heads/<branch>
in your repository.
That written, if you're really into tracking this information in your repository, check out branch descriptions. They allow you to attach arbitrary metadata to branches, locally at least.
Also DarVar's answer below is a very clever way to get at this information.
We can find out based upon authorname
git for-each-ref --format='%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)' refs/remotes/ --sort=authorname DESC