My shell prompt looks like this: ➜ ~ git:(master) ✗. How can I get my normal prompt back?
I know your problem , You are using zsh
, right?
If so, you should add export PS1=xxxxx
to ~/.zshrc
, not ~/.bashrc
.
Or you just don't use zsh
, input bash
and switch to bash.input
chsh -s /bin/bash
to change the default shell to bash
.
git branch ~(END) on terminal?
Git pipes long output into what's called a pager by default, which can make it easier to view the output if it doesn't fit on a screen. The ~ characters indicate that those lines were not in the original output, but it's showing them so that you can scroll down past the bottom (i.e. the last line of output can go up to the top of the screen).
You typically can use the arrow keys to scroll up or down, and can exit by pressing q.
What does (master) next to folder path mean?
master is the default branch in git. you should read the documentation for more details : https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell
Correct return value in BASH prompt
You do:
..$(__git_ps1)...\`if [[ $? == 0 ]];
The $?
is going to be return status of __git_ps1
not the last executed command on command line.
Try saving the exit return value in the first command substitution block right away:
if [ "$color_prompt" = yes ]; then
color_reset=$(tput sgr0)
color_bold=$(tput bold)
color_white=$(tput setaf 7)
color_jobs=$(tput setaf 7)
color_user=$(tput setaf 3)
color_dir=$(tput setaf 4)
color_load=$(tput setaf 5)
color_succeed=$(tput setaf 2)
color_fail=$(tput setaf 1)
sep=$(tput setaf 7)\)
else
color_reset=
color_bold=
color_white=
color_jobs=
color_user=
color_dir=
color_load=
color_succeed=
color_fail=
sep=\) # remove the braces...
fi
# note the quotes - "" expand at setting time, '' expand at runtime
PS1=
PS1+="${color_user}\u${sep}\[\D{%T}\]${sep}${color_reset}"
PS1+='$('
PS1+='ret=$?; ' # first thing we do - save the exit return value
PS1+='__git_ps1; '
PS1+='printf "%s" "'
PS1+="${color_dir}\W${color_reset}${sep}"
PS1+='"; '
PS1+='if ((ret == 0)); then '
PS1+='printf "%s" "'
PS1+="${color_succeed}" # expand variable on assignment side
PS1+='0"; ' # this looks strange. Just print first the color, then $ret...
PS1+='else '
PS1+='printf "%s" "'
PS1+="$color_fail"
PS1+='$ret"; '
PS1+='fi '
PS1+=')'
PS1+="${color_white}${sep}${color_reset}"
PS1+='\$ ' # note - this is *not* "\$ "
What does “~ (END)” mean when displayed in a terminal?
Git pipes long output into what's called a pager by default, which can make it easier to view the output if it doesn't fit on a screen. The ~
characters indicate that those lines were not in the original output, but it's showing them so that you can scroll down past the bottom (i.e. the last line of output can go up to the top of the screen).
You typically can use the arrow keys to scroll up or down, and can exit by pressing q
.
Alternatively, if you don't want the output in a pager, try this:
$ git --no-pager hist --all
Related Topics
How to Cut an Existing Variable and Assign to a New Variable in Bash
How to Use an Older Version of Gcc in Linux
How to Disable CPU Cache (L1/L2) on a Linux System
How to Force 'Cp' to Overwrite Directory Instead of Creating Another One Inside
What's the Difference Between Event-Driven and Asynchronous? Between Epoll and Aio
Abuse Curl to Communicate with Redis
Does the Thundering Herd Problem Exist on Linux Anymore
Difference Between Gnuwin32 and Cygwin
What Happens If You Mount to a Non-Empty Mount Point with Fuse
Get Filesystem Mount Point in Kernel Module
Insert New Line to Bash Prompts
How to Build an App for an Old Linux Distribution, and Avoid the Fatal: Kernel Too Old Error
How to Put the Current Running Linux Process in Background
Is It Safe to Delete the Journal File of Mongodb
How to Use 'Mv' Command to Move Files Except Those in a Specific Directory