Alias frequently use

March 01, 2017 | 1 Minute Read

I often use it with Oh My Zsh.

alias ..="cd .."
alias ...="cd ../.."

alias h='cd ~'
alias c='clear'
alias art=artisan

alias a='echo "------------Your aliases------------";alias'
alias sa='source ~/.bash_aliases;echo "Bash aliases sourced."'

# Aliases
alias g='git'
alias gst='git status'
alias gl='git pull'
alias gup='git fetch && git rebase'
alias gp='git push'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gco='git checkout'
alias gcm='git checkout master'
alias gb='git branch'
alias gba='git branch -a'
alias gcount='git shortlog -sn'
alias ga='git add'

# Will return the current branch name
# Usage example: git pull origin $(current_branch)
function current_branch() {
      ref=$(git symbolic-ref HEAD 2> /dev/null) || return
        echo ${ref#refs/heads/}

function current_repository() {
      ref=$(git symbolic-ref HEAD 2> /dev/null) || return
        echo $(git remote -v | cut -d':' -f 2)

# these aliases take advantage of the previous function
alias ggpull='git pull origin $(current_branch)'
alias ggpush='git push origin $(current_branch)'
alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'