# Some git commands for use in bourne-like shells; # some could be aliases. gshow_old_branch() { local old old=$( git branch ) printf "## Moving from %s\n" "${old}" >&2 } gmerge() { git mergetool } gcon() { git rebase --continue } gskip() { git rebase --skip } gabort() { git rebase --abort } ghard() { git reset --hard $@ } gwhere() { git branch } ghelp() { git "${1}" --help } gadjust() { git rebase -i $@ } grephrase() { git commit --amend } gcd() { case $# in 0 ) printf "Need a branch to change to\n" >&2 return 1 ;; * ) git checkout "$1" ;; esac } gupdate() { gshow_old_branch git checkout master \ && git pull --rebase } gplop() { case $# in 0 | 1 ) printf "Need a branch to change and a branch to rebase on\n" >&2 exit 1 ;; * ) ;; esac set +x local in="$1" local out="$2" git checkout "$out" && git rebase "$in" [ $? -eq 0 ] || return case $# in 2 ) ;; * ) shift shift set -- $out $@ set +x gplop $@ ;; esac } glastmerge() { git ci -a -m '# (merge with previous)' \ && git rebase -i HEAD^^ } gpick() { for m in $@ do git cherry-pick "${m}" || break done } gitm() { date='last 5 months' gitk --all --date-order --since="$date" $@ } gdiff() { git diff $@ } gpatch() { git diff --no-color $@ } gmovetag() { local tag pos case $# in 0 | 1 ) printf "Need both an tag to move and the new location.\n" >&1 exit 1 ;; * ) tag="${1}" pos="${2}" ;; esac set +x git tag -d "${tag}" git tag -a "${tag}" "${pos}" -m 'Reset mark.' set +x }