Search code examples
gitzshprompt

To have extra info at a prompt for Git by Zsh


Torvalds seems to have the following prompt.

[torvalds@g5 git]$ 

The first word is username. g5 seems to be a branch in Git repo, while git shows that it is a branch in Git.

My current prompt

PROMPT="$"

How can you have a similar prompt as Torvalds'?


Solution

  • Actually, I'm guessing that g5 refers to the hostname of the machine he is currently working on, and git is the current working directory. The format [user@hostname dir]$ is a pretty standard (i.e., widely-used) shell prompt.