Last active
January 28, 2023 01:30
-
-
Save tiagofrancafernandes/0ddbed3f8f30bf2aeb9f211a6d468636 to your computer and use it in GitHub Desktop.
git-ps1-pure | linuxbashrcgit-puro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export HISTCONTROL=ignoredups:erasedups:ignorespace | |
## Bash PS1 with git branch | |
gbranch() | |
{ | |
if [ -d .git ]; then | |
local ref_branch=$(git symbolic-ref --short HEAD 2> /dev/null) | |
echo BRANCH ["${ref_branch:-}"]; | |
fi | |
} | |
machine_name() | |
{ | |
echo "\${MACHINE_NAME}" | |
} | |
PS1=" | |
\[\e[91m\]`machine_name` | \[\e[38;5;26m\]\$(whoami)\[\e[0m\]\[\e[38;5;208m\]@\[\e[92m\]\h | \[\e[91m\]\$(date +"%Y-%m-%d_%H:%M:%S" | sed 's/\//-/g') | |
\[\e[92m\]\$(pwd) | |
\[\e[38;5;208m\]\`gbranch\`\[\e[38;5;26m\][\\$]~>\[\e[0m\] " | |
## Manter essa linha para que seja renomeado o título do terminal | |
## O título da aba é o nome da pasta | |
PS1="\[\e]0;${debian_chroot:+($debian_chroot)} \w\a\]$PS1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## https://gist.github.com/tiagofrancafernandes/0ddbed3f8f30bf2aeb9f211a6d468636/raw/git-ps1-pure.sh | |
# Install on bash | |
curl -o ~/git-ps1-pure.sh https://gist.githubusercontent.com/tiagofrancafernandes/0ddbed3f8f30bf2aeb9f211a6d468636/raw/git-ps1-pure.sh && echo 'if [ -f ~/git-ps1-pure.sh ]; then source ~/git-ps1-pure.sh; fi' >> ~/.bashrc && source ~/.bashrc | |
## Alter mode | |
curl -o ~/git-ps1-pure.sh https://gist.github.com/tiagofrancafernandes/0ddbed3f8f30bf2aeb9f211a6d468636/raw/git-ps1-pure.sh && echo 'if [ -f ~/git-ps1-pure.sh ]; then source ~/git-ps1-pure.sh; fi' >> ~/.bashrc && source ~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment