dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

changed (379B) [raw]


      1 #!/bin/sh
      2 # changed -- diff against the merge-base
      3 die() {
      4 	echo "ERROR: $*" 1>&2
      5 	exit 1
      6 }
      7 
      8 REPO=$(git rev-parse --show-toplevel 2>/dev/null)
      9 BASE=${BASE:-main}
     10 if [ -n "$REPO" ]; then
     11 	MBASE="$(git merge-base origin/$BASE HEAD 2>/dev/null)"
     12 	[ -z "$MBASE" ] && die "origin/$BASE doesn't exist; set \$BASE and try again"
     13 	git diff "$@" "$MBASE"
     14 else
     15 	die "not in a git repo"
     16 fi