Skip to content

Instantly share code, notes, and snippets.

@lynchjames
Created May 26, 2011 10:06
Show Gist options
  • Save lynchjames/992875 to your computer and use it in GitHub Desktop.
Save lynchjames/992875 to your computer and use it in GitHub Desktop.
.bashrc
#alias merge='git checkout master;git merge dev; git checkout dev'
#alias rebase='git checkout master;git pull origin master;git checkout dev;git rebase master'
#alias rebmerge='rebase; merge'
#alias pushmaster='git checkout master; git push origin master; git checkout dev'
#alias mpm='merge; pushmaster;'
#alias rmpm='rebmerge; pushmaster;'
alias l='git log'
alias s='git s'
alias d='git d'
alias av='git av'
alias cm='git cm'
alias cmm='git cm -m'
alias cod='git cod'
alias com='git com'
alias co='git co'
alias st='git stash'
alias pop='git stash pop'
alias warmup='"/C/Program Files/warmup/warmup.exe"'
alias ..='cd ..'
function merge { git checkout ${1:-master}; git merge ${2:-dev}; git checkout ${2:-dev}; }
function rebase { git checkout ${1:-master}; git pull origin ${1:-master}; git checkout ${2:-dev}; git rebase ${1:-master}; }
function rebmerge { rebase ${1:-master} ${2:-dev}; merge ${1:-master} ${2:-dev}; }
function pushmaster { git checkout ${1:-master}; git push origin ${1:-master}; git checkout ${2:-dev}; }
function mpm { merge ${1:-master} ${2:-dev}; pushmaster ${1:-master} ${2:-dev}; }
function rmpm { rebmerge ${1:-master} ${2:-dev}; pushmaster ${1:-master} ${2:-dev}; }
function parse_git_dirty {
status=`git status 2> /dev/null`
dirty=` echo -n "${status}" 2> /dev/null | grep -q "Changed but not updated" 2> /dev/null; echo "$?"`
untracked=`echo -n "${status}" 2> /dev/null | grep -q "Untracked files" 2> /dev/null; echo "$?"`
ahead=` echo -n "${status}" 2> /dev/null | grep -q "Your branch is ahead of" 2> /dev/null; echo "$?"`
newfile=` echo -n "${status}" 2> /dev/null | grep -q "new file:" 2> /dev/null; echo "$?"`
renamed=` echo -n "${status}" 2> /dev/null | grep -q "renamed:" 2> /dev/null; echo "$?"`
bits=''
if [ "${dirty}" == "0" ]; then
bits="${bits}?"
fi
if [ "${untracked}" == "0" ]; then
bits="${bits}?"
fi
if [ "${newfile}" == "0" ]; then
bits="${bits}*"
fi
if [ "${ahead}" == "0" ]; then
bits="${bits}+"
fi
if [ "${renamed}" == "0" ]; then
bits="${bits}>"
fi
echo "${bits}"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/(\1$(parse_git_dirty))/"
}
function parse_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
}
export PS1='\[\033[00;32m\]\u\[\033[01m\]@\[\033[00;36m\]\h\[\033[01m\] \! \[\033[00;35m\]\w\[\033[00m\]\[\033[01;30m\]$(parse_git_branch)\[\033[00m\]\$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment