Skip to content

Instantly share code, notes, and snippets.

@Mierenga
Created August 7, 2018 20:37
Show Gist options
  • Save Mierenga/d2b8d6420477f32efcfb619df94ae59e to your computer and use it in GitHub Desktop.
Save Mierenga/d2b8d6420477f32efcfb619df94ae59e to your computer and use it in GitHub Desktop.
Aliases
# basic
alias la="ls -a"
alias ch='cd ~'
alias c='clear'
alias ..='cd ..;'
alias untar='tar -zxvf'
alias grep='grep --color=auto'
alias sw='telnet towel.blinkenlights.nl'
# git
alias gs="git status"
alias ga="git add -u"
alias gd="git d --staged"
alias gcm="git commit -m"
alias gb="git branch"
alias krono="git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'"
alias gcf="git add -u && git commit -m \"format\" && git push"
alias gcu="git add -u && git commit -m \"update\" && git push"
alias glog="git log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
alias ss="substatus" # see substatus definition below
# misc
alias ea='editalias'
# FUNCTIONS #
# edit an alias and have it ready to use when done
function editalias()
{
vim ~/rc/.bash_aliases
echo "source ~/rc/.bash_aliases"
. ~/rc/.bash_aliases
}
# grep: do a recursive grep from current location
function grepr() { grep -nr "$1" .; }
alias gr="grepr";
# Git: get that status of all git subdirectories
function substatus()
{
find . -maxdepth 1 -mindepth 1 -type d -exec sh -c '(echo {} && cd {} && git status -s && echo)' \;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment