Skip to content

Instantly share code, notes, and snippets.

@lulalachen
Last active March 11, 2016 06:53
Show Gist options
  • Save lulalachen/76f1e1ff964ab144f4b8 to your computer and use it in GitHub Desktop.
Save lulalachen/76f1e1ff964ab144f4b8 to your computer and use it in GitHub Desktop.
Useful Aliases
# ~/.aliases
# Put alias under this file
## Directory
alias wk="cd ~/Documents/workspace"
## Alias
alias sourcealias="source ~/.zshrc" # source new alias
alias newalias="createAlias && sourcealias" # eg: $newalias goToHomeAndSayHello "cd ~ && echo 'hello'"
createAlias() {
echo "alias $1=\"$2\"" | cat - ~/.aliases > temp && mv temp ~/.aliases
}
## Git
alias gl="git log --oneline"
alias gs="git status"
alias gp="git pull"
alias gd="git checkout develop"
alias nt="gd && git pull"
alias rebaseToDevelop="nt && gco @{-1} && git rebase develop"
alias rebasePrevious=rebaseHEAD
rebaseHEAD() {
git rebase -i HEAD~"$1"
}
## npm development
alias go="npm run watch"
alias gotest="npm run test:watch"
# ~/.zshrc or ~/.bashrc
if [ -f $HOME/.aliases ]; then
. $HOME/.aliases
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment