This is probably a dumb mistake. I am using this as a basis for a bash function to try to create a bash script for this git function:
branch() {
if [[ $@ == "-r" ]]; then
command for k in `git branch -r | perl -pe 's/^..(.*?)( ->.*)?$/\1/'`; do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k -- | head -n 1`\\t$k; done | sort -r
else
command for k in `git branch | perl -pe s/^..//`; do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k -- | head -n 1`\\t$k; done | sort -r
fi
}
When I try to source this, it actually is trying to execute the commands - and then gives a syntax error because of this.
I am able to execute the commands locally, so clearly I am missing something obvious in creating my function here.