From fd88c58e90887eab5d3586a6b1e3a88b52587e90 Mon Sep 17 00:00:00 2001 From: William Hilton Date: Fri, 5 Apr 2019 14:51:15 -0400 Subject: [PATCH] add 'g hist' --- README.md | 1 + bin/g | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index a7c1e7b..0c5f954 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,7 @@ g log | git log --graph --pretty=format:'%h - %d %s (%cr) <%an>' --abbrev-commit g ignore *file* | Adds *file* to the current .gitignore file g submodule | Finds all git repos underneath the main repo and makes them submodules g squash *n* | Squash the last *n* commits into one commit. +g hist | List branches you've recently visited and when (I was about to call it `g recent` but I mistyped and did `g reset`... hence the new name.) #### Shortcuts Because sometimes you just want to type one letter. diff --git a/bin/g b/bin/g index 2254750..7e46e46 100755 --- a/bin/g +++ b/bin/g @@ -508,6 +508,12 @@ git log --color \ echo '' ;; +hist) +git reflog HEAD@{now} --date=relative \ +|awk '$5 ~ /checkout:/ { sub(/HEAD@/, "", $2); sub(/:/, "", $4); if (!seen[$10]++) print $10, $2, $3, $4}' +echo '' +;; + submodule) CWD=$(pwd) gitroot=$(git_root)