Created
February 12, 2015 22:00
-
-
Save nybblr/3ff816278d971713519b to your computer and use it in GitHub Desktop.
Git aliases for writers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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