By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

PROMPT with git branch

I'm looking to duplicate some of the functionality that my other programmer friends utilize in TCC.

Specifically, the ability to output the current git-branch of the directory that I'm in.

Not every directory will be a git directory, and I would want any directory under the local repo to report the branch.

Anyone accomplished this?
I am not familiar with git. How do you get the information you are interested in? I assume there is a git command that returns that information.

Assuming you have a function that returns the text you want, lets call it @gitbranch, you could create a PROMPT that looks like this:
PROMPT [%@if[%@gitbranch[].==.,,(%@gitbranch[]) ]$P]$s

You could also do something similar with TITLEPROMPT to update the Tab text or console window title.

Assuming the command to get the branch is "git branch --list" then a simple @gitbranch could be:
function gitbranch=`%@execstr[git branch --list]`
If the command returns data that needs to be parsed, then you can use @WORD and/or have @execstr return a specific line of the output.
[FOX] Ultimate Translator