When I use Windows, the shell (even a standard Windows shell) shows basic information about the git repository when you are in a git repository. Things like the active branch and maybe some color coding.
Is there a way to have the same in Ubuntu?
command linegit
When I use Windows, the shell (even a standard Windows shell) shows basic information about the git repository when you are in a git repository. Things like the active branch and maybe some color coding.
Is there a way to have the same in Ubuntu?
Best Answer
The Windows Git shell, which is really just bash, sets the prompt
$PS1
to a long string that includes$(__git_ps1)
.__git_ps1
is defined as a function, nearly 100 lines long, that prints the name of the current branch in parentheses./etc/profile
(which isC:\Program Files (x86)\Git\etc\profile
, at least on my system)) invokes/etc/git-completion.bash
, which defines the__git_ps1
function, sets$PS1
, defines some git-specific completions, among other things.The
git-completion.bash
used by Git Bash appears to be based on this.