Based on my search , the below 2 commands are supposed to give me remote branches with their author name. However, I get nothing in return - do you know why ?
I am using windows command prompt.
The below command returns : "Input file specified two times."
git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | sort -k5n -k2M -k3n -k4n
The below command returns nothing :
git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)'
What should I do to list all active branches with their author names ?
You are trying to run a Unix-Command in a Windows cmd
shell. The Windows sort
does not understand the -k5n
syntax. Try running it in the bash
shell provided by Git For Windows and it will not print errors.
There is room for improvement though: git for-each-ref
can sort itself:
git for-each-ref --sort=committerdate --format='%(committerdate) %09 %(authorname) %09 %(refname)'
Next: You mentioned you want only remote branches. Actually you also get local branches, tags, notes and perhaps some more stuff. You can restrict it to remote branches:
git for-each-ref --sort=committerdate --format='%(committerdate) %09 %(authorname) %09 %(refname)' refs/remotes
Since there is no sort
command any more you can run it in cmd
again after adjusting the quoting of the format
parameter (cmd
and bash
use different quoting semantics):
git for-each-ref --sort=committerdate --format="%(committerdate) %09 %(authorname) %09 %(refname)" refs/remotes
You should try to put double quotes instead of simple :
git for-each-ref --format="%(committerdate) %09 %(authorname) %09 %(refname)" | sort -k5n -k2M -k3n -k4n
If it doesn't work, just try without the sort
causing the error :
git for-each-ref --format="%(committerdate) %09 %(authorname) %09 %(refname)"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With