if [ -f ${BASH_SOURCE%/*}/../.git/config ]; then # You always want to do rebase pulls. alias pull='git pull --rebase' # You always want to pull before pushing, to avoid spurious collisions. alias push='pull && git push' # Commits, and prepends the current directory name to the commit message. # Just pass it the commit message as an argument. function save { local msg=$1; shift git commit -a -m "[${PWD##*/}] ${msg}" $* } elif [ -f ${BASH_SOURCE%/*}/../.hg/hgrc ]; then # You always want to do rebase pulls. alias pull='hg pull --rebase' # You always want to pull before pushing, to avoid spurious collisions. alias push='pull && hg push' # Commits, and prepends the current directory name to the commit message. # Just pass it the commit message as an argument. function save { local msg=$1; shift hg commit -m "[${PWD##*/}] ${msg}" $* } # Regens, commits, and pulls/pushes, all in one package. # Pass it the commit message as an argument. function rcommit { regenerate && save "${1}" . && push } else echo "Neither .git nor .hg found" exit 1 fi