I've set up my windows machine to be unix like.
I've installed gitforwindows which includes git-bash
I am trying to show my current git branch in my command prompt but it isn't working.
I have PS1=$TIME$USER$HOST$LOCATION$BRANCH
in by .bashrc
TIME, USER, HOST, LOCATION work ok, same as ubuntu and osx
However branch isn't showing and I get:
bash: command substitution: line 1: syntax error near unexpected token `)'
bash: command substitution: line 1: `git branch)'
BRANCH is:
BRANCH=' \[\033[00:33m\]$(git_branch) \[\033[00\]\n\$ '
and the git_branch function - which works ok when used in isolation is defined as:
git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
Every format I've tried has failed :(
Rest of PS1 looks like this:
On UNIX when in a git repo I can see the branch like this:
.../whatever-git-instal/bin/
to your path.Then just use normal git aliases (which are more portable) to produce command output... It's not really a clear question - what tools are you using (other then git)? – code_fodder Apr 7 '18 at 19:57