summaryrefslogtreecommitdiff
path: root/bin/git-bdiff
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2023-12-13 21:39:47 -0500
committerOwen Jacobson <owen@grimoire.ca>2023-12-13 22:10:56 -0500
commitb7e2019eeed38d3b22f07c51aac8578fd53c9bee (patch)
tree157b6e31f4d053995f113890faa9bed003fdf156 /bin/git-bdiff
parent4f32cdbb3681488b9f9215e253a5754800ebaab8 (diff)
Move aliases to scripts.
The git aliases mechanism is pretty limited; there's some stuff you can't really do without dropping to a shell. If you're going to do that, then custom subcommand scripts are more flexable than aliases that start with ! are.
Diffstat (limited to 'bin/git-bdiff')
-rwxr-xr-xbin/git-bdiff11
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/git-bdiff b/bin/git-bdiff
new file mode 100755
index 0000000..eb93d13
--- /dev/null
+++ b/bin/git-bdiff
@@ -0,0 +1,11 @@
+#!/bin/bash -e
+
+# Diff for a branch, starting from where it diverges from its upstream.
+
+BRANCH=HEAD
+if [ $# -gt 0 ]; then
+ BRANCH="$1"
+ shift
+fi
+
+exec git diff "${BRANCH}@{upstream}" "${BRANCH}" "$@"