When I recently used Git bash, it was mostly too long to see the default terminal prompt uncomfortable. So you want to optimize the Git terminal prompt
The default Git terminal prompt will be the username @ device name and I want to change it to a shorter one to view.
The prompt is defined by an environment variable, called PS1 (the shorthand for "prompt string One"). We can use the echo command to view the contents of the PS1:
echo $PS 1
\[\033]0; $MSYSTEM: ${pwd//[^[:ascii:]]/?} \007\]\n\[\033[32m\]\[email protected]\h \[\033[33m\]\w$ (__GIT_PS1) \[\033[0m\]\n$
The files that set the PS1 variable are not the same in Windows and Mac locations.
under Windows location:
# assuming Git is installed in the C:\Program files directory
C:\Program Files\git\etc\profile
Open the file to find:
ps1= "$PS 1" ' \[email protected]\h ' # [email protected]<space>ps1= "$PS 1" ' \[\033[33m\] ' # change colorPS1 = "$PS 1" ' \w ' # Current working directory
Change to:
ps1= "$PS 1" ' \w ' # Current Working nameps1= "$PS 1" ' \[\033[33m\] ' # change colorps1= ' $PS 1 ' ' \$ ' # End Add < space>$
Mac Location:
~/.bash_profile
Specific set production test:
Http://billie66.github.io/TLCL/book/chap14.html
Git tutorials:
Http://git-scm.com/docs
Gitforwindows Chinese garbled problem:
https://github.com/mrljdx/gitforwindows-
Mac Oh_my_zsh Terminal small yellow fork tip:
http://foocoder.com/blog/wo-zai-yong-de-macruan-jian-2.html/
Other similar documents:
http://equation85.github.io/blog/customize-terminal-on-mac/
git terminal prompt