Skip to content

Instantly share code, notes, and snippets.

@CLOVIS-AI
Last active June 3, 2018 17:08
Show Gist options
  • Save CLOVIS-AI/8559580fec60b7908a6790509bd7e806 to your computer and use it in GitHub Desktop.
Save CLOVIS-AI/8559580fec60b7908a6790509bd7e806 to your computer and use it in GitHub Desktop.
Most common git aliases
#!/bin/bash
# Displays the list of aliases
git config --global alias.aliases "config --get-regexp '^alias\.'"
# Shortcuts
git config --global alias.st 'status'
git config --global alias.co 'checkout'
git config --global alias.a 'add'
git config --global alias.c 'commit'
git config --global alias.cm 'commit -m'
# Clones recursively (cloning also the submodules, if any)
git config --global alias.cl 'clone --recursive'
# Improved log command
git config --global alias.glog "log --graph --oneline --decorate=short --branches='*'"
# Removes branches that were deleted on the remote
git config --global alias.p 'pull -p'
git config --global alias.ps 'push'
git config --global alias.f 'fetch -p'
# .bashrc : print git branch in the bash prompt
#parse_git_branch() {
# git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
#}
#export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment