Skip to content

Instantly share code, notes, and snippets.

@davidjguru
Created March 31, 2022 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidjguru/d5d5ca92302cd7de92d3451635f9d047 to your computer and use it in GitHub Desktop.
Save davidjguru/d5d5ca92302cd7de92d3451635f9d047 to your computer and use it in GitHub Desktop.
Gathering my favourite git aliases (from the Linux OS level, not like Git aliases).

Git Related Aliases

Getting basic info of the situation of your project: status, branches, current branch, naming of remote repo.

alias gs='git status'
alias gb='git branch'
alias gr='git remote -v'
alias gp='git rev-parse --abbrev-ref HEAD'

Getting info from 'Git log' about last commits, last changed files in 12 months by order and by commit message.

alias gl='git log --oneline'  
alias glc="git log --format=format: --name-only --since=12.month | egrep -v '^$' | sort | uniq -c  | sort -nr | head -50"  
alias gld="git log --oneline --decorate --graph --all"  
alias glp="git log -g --grep='PHP' -10 --pretty='%h - %s - %cn - %cd'"
alias glf='git for-each-ref --sort=-committerdate'   

Pushing to basic branches and Pulling contents updating all your local branches.

alias gsup='git submodule update --init --recursive'
alias gpom='git push origin main'  
alias gpod='git push origin develop'  
alias gupb="git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done && git fetch --all && git pull --all"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment