Unix command aliases

By | February 7, 2019

puneethabm_unix_useful_commands

Useful unix commands files - bashrc

Source the file to make the aliases effective

source ~/.bashrc
# Git commands

alias git_stat="git log --stat --oneline"

alias git_pretty="git log --pretty=oneline"

alias git_pretty_graph="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"


# Adding alias in git
# $ git config --global alias.pbmprettyprint "log --pretty=oneline"
# Execute: $ git pbmprettyprint

git log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short

# Switch local branch
# git checkout
alais git_checkout_local="git checkout "

# git checkout -b HEAD
alais git_checkout_remote="git checkout -b "


# Reference:
# https://jonsuh.com/blog/git-command-line-shortcuts/
alias git_a='git add'
alias git_aa='git add .'
alias git_aaa='git add --all'
alias git_au='git add --update'
alias git_b='git branch'
alias git_bd='git branch --delete '
alias git_c='git commit'
alias git_cm='git commit --message'
alias git_cf='git commit --fixup'
alias git_co='git checkout'
alias git_cob='git checkout -b'
alias git_com='git checkout master'
alias git_cos='git checkout staging'
alias git_cod='git checkout develop'
alias git_d='git diff'
alias git_da='git diff HEAD'
alias git_i='git init'
alias git_m='git merge --no-ff'
alias git_ma='git merge --abort'
alias git_mc='git merge --continue'
alias git_p='git pull'
alias git_pr='git pull --rebase'
alias git_r='git rebase'
alias git_s='git status'
alias git_ss='git status --short'
alias git_st='git stash'
alias git_sta='git stash apply'
alias git_std='git stash drop'
alias git_stl='git stash list'
alias git_stp='git stash pop'
alias git_sts='git stash save'
alias git_lg='git log --graph --oneline --decorate --all'
alias git_ld='git log --pretty=format:"%h %ad %s" --date=short --all'
alias git_ls='git log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate'
alias git_ll='git log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat'


# Git log find by commit message
# Ex: $ glf "Add python script"
function glf() { git log --all --grep="$1"; }

# Test -3

Leave a Reply

Your email address will not be published. Required fields are marked *