Skip to content

Instantly share code, notes, and snippets.

@tiagofrancafernandes
Last active January 28, 2023 01:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tiagofrancafernandes/0ddbed3f8f30bf2aeb9f211a6d468636 to your computer and use it in GitHub Desktop.
Save tiagofrancafernandes/0ddbed3f8f30bf2aeb9f211a6d468636 to your computer and use it in GitHub Desktop.
git-ps1-pure | linuxbashrcgit-puro
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"
## 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