Last active
November 19, 2022 20:25
-
-
Save mebaysan/4f4556c2c749314b43175af33ec56a4b to your computer and use it in GitHub Desktop.
My Git Aliases for Bash
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
# My aliases | |
alias gs='git status -sb' | |
alias gaa='git add --all' | |
alias gc='git commit -m $2' | |
alias gp='git push' | |
alias gpo='git push origin' | |
alias gpl='git pull' | |
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" | |
alias ga='git add $2' | |
alias gb='git branch' | |
alias gcb='git checkout -b $2' | |
alias gdb='git branch -D $2' | |
alias gco='git checkout $2' | |
get_doc_baysan_alias(){ | |
echo "Baysan's Git Aliases" | |
echo "gs=git status" | |
echo "gaa=git add --all" | |
echo "gc=git commit -m \$2" | |
echo "gp=git push" | |
echo "gpo=git push origin" | |
echo "gpl=git pull" | |
echo "gl=git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" | |
echo "ga=git add \$1" | |
echo "gb=git branch \$2" | |
echo "gcb=git checkout -b \$2" | |
echo "gdb=git branch -D \$2" | |
echo "gco=git checkout \$2" | |
} | |
alias ghelp='get_doc_baysan_alias' | |
# Style | |
source ~/.bash_git | |
__PS1_BEFORE='\n ' | |
__PS1_USER='\[\e[97;104m\] \u ' | |
__PS1_LOCATION='\[\e[30;43m\] \w ' | |
__PS1_GIT_BRANCH='\[\e[97;45m\] `__git_ps1` ' | |
__PS1_AFTER='\[\e[0m\] ' | |
export PS1="${__PS1_BEFORE}${__PS1_USER}${__PS1_LOCATION}${__PS1_GIT_BRANCH}${__PS1_AFTER}" |
https://stackoverflow.com/questions/15384025/bash-git-ps1-command-not-found
curl -L https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh > ~/.bash_git
source ~/.bash_git
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should append the content into the path below.
/home/<username>/.bashrc