Skip to content

Instantly share code, notes, and snippets.

@nybblr
Created February 12, 2015 22:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nybblr/3ff816278d971713519b to your computer and use it in GitHub Desktop.
Save nybblr/3ff816278d971713519b to your computer and use it in GitHub Desktop.
Git aliases for writers
alias la='ls -la'
alias gl='git pull'
alias gp='git push'
alias gb='git branch'
alias gco='git checkout'
alias gs='git status -sb'
alias gc='git commit -m'
alias gaa='git add -A'
alias gca='git add -A && git commit -m'
alias gd='git diff --color-words'
gbn() {
current_branch=$(git symbolic-ref -q HEAD)
if [[ "refs/heads/master" == "$current_branch" ]]; then
git checkout -b "$*"
else
echo "Uh-oh, you're not branching off master! You probably should =)"
fi
}
gbcp() {
message="$*"
branch="$(echo -n $message | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | sed -e 's/^-//' | sed -e 's/-$//' | tr A-Z a-z)"
gbn $branch && gca $message && git push
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment