Both of these commands work from the command line
git symbolic-ref HEAD | sed -e "s#^refs/heads/##"
and
git branch | grep \* | cut -d ' ' -f2
When added to gitconfig under [alias]
thisbranch = !git symbolic-ref HEAD | sed -e "s#^refs/heads/##"
thisbranch2 = !git branch | grep \* | cut -d ' ' -f2
I get fatal: bad config line 16 in file /Users/<me>/.gitconfig
which is the second line. My initial problem was getting the current branch into an alias thanks to this answer. So I am mainly curious why both work on the command line, but only 1 can work in config. I am guessing it's the ' '
needs to be escaped, but that's just a guess.