Browse code

Add config alias refdiff

Robert Cranston authored on 18/12/2022 04:28:27
Showing 1 changed files

... ...
@@ -245,6 +245,21 @@
245 245
 	  done; \
246 246
 	}; f"
247 247
 
248
+	; Refdiff.
249
+	refdiff = "!f() { : git diff ; \
250
+	  git config --get-colorbool color.diff && color_diff=always; \
251
+	  git reflog --pretty='format:%h: %gs' \
252
+	  | awk -F': ' '$2~/(commit|rebase).*\\((amend|finish)\\)/{print $1}' \
253
+	  | while read -r ref; \
254
+	  do \
255
+	    git -c color.diff=$color_diff show --no-patch $ref; \
256
+	    echo; \
257
+	    git -c color.diff=$color_diff diff \"$@\" $ref HEAD; \
258
+	    echo; \
259
+	  done \
260
+	  | eval \"LESS=${LESS-FRX} $(git var GIT_PAGER)\"; \
261
+	}; f"
262
+
248 263
 	; Log.
249 264
 	l = "!f() { : git log ; \
250 265
 	  git config --get-colorbool color.diff && color_diff=always; \