Created
June 4, 2012 21:43
-
-
Save h3h/2871006 to your computer and use it in GitHub Desktop.
My Git Aliases
This file contains hidden or 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
# awesome git prompt | |
export GIT_PS1_SHOWDIRTYSTATE=1 | |
export GIT_PS1_SHOWSTASHSTATE=1 | |
export GIT_PS1_SHOWUPSTREAM="auto" | |
export PS1="${WHITE}\$(date +%H:%M) ${CYAN}\w ${RED}\$(~/.rvm/bin/rvm-prompt v)${GREEN}\$(__git_ps1)${WHITE}\$${RESET} " | |
export TERM="xterm-256color" | |
# scm stuff | |
alias gp="git pull" | |
alias gpu="git push" | |
alias gst="git status" | |
alias gbr="git branch $@" | |
alias gco="git co" | |
function gpa() | |
{ | |
for branch in `git branch | cut -c 3-`; do | |
`git co $branch && git pull`; | |
done | |
} | |
function gcb() | |
{ | |
git branch | grep '^\*' | cut -c3- | |
} | |
function gbp() | |
{ | |
git fetch && git rebase origin/`gcb` | |
} | |
function gpu() | |
{ | |
git push origin `gcb` | |
} | |
alias ga="git add" | |
alias gaa="git add ." | |
alias gf="git fetch" | |
alias gp="git pull" | |
alias gst="git status -s" | |
alias gbr="git branch $@" | |
alias gdi="git diff $@ | mate" | |
alias gdic="git diff --cached | mate" | |
alias gsl="git stash list" | |
alias gsa="git stash pop" | |
alias gcl="git clean | grep -v 'Not removing'" | |
alias gg="git commit -v" | |
alias gk="gitk --all &" | |
alias gx="gitx" | |
alias gpp="gp && gpu" | |
function gpn() { | |
git push -u origin `gcb` | |
} | |
function gpr() { | |
repo=$(grep '\burl\b' .git/config | cut -d: -f2 | sed -e 's/\.git//') | |
open "https://github.com/$repo/pull/new/`gcb`" | |
} | |
function gdd() { | |
[[ `gcb` == 'master' ]] && branch=$1 || branch=`gcb` | |
if [[ -z `git branch --no-merged master | grep $branch` ]]; then | |
echo "Deleting branch $branch..." | |
git branch -d $branch && git push origin :$branch | |
else | |
echo "That branch hasn't been merged yet!" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment