From 9b0d054f7c27f1d133be42fd8bd546e168645629 Mon Sep 17 00:00:00 2001 From: John Freeman Date: Mon, 27 Apr 2020 20:23:19 +0100 Subject: [PATCH] Add git lb alias to view recent branches (#682) Helps if you have a lot of branches. --- docs/_docs/features.md | 6 +++++- provisioning/playbook.yml | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/_docs/features.md b/docs/_docs/features.md index 2a7e46f6..e8cca0a9 100644 --- a/docs/_docs/features.md +++ b/docs/_docs/features.md @@ -5,7 +5,7 @@ description: > Features provided by the GantSign EnV development environment. numbered_headings: yes date: 2017-01-18T16:35:52+00:00 -modified: 2020-04-26T21:29:53+01:00 +modified: 2020-04-27T20:13:27+01:00 --- There are a lot of well known projects, and hidden gems, which aid in your @@ -434,6 +434,10 @@ Git commands: `git pop` ≡ `git stash pop` +* List the most recently checked-out branches + + `git lb` ≡ `!git reflog show --pretty=format:'%gs ~ %gd' --date=relative | grep 'checkout:' | grep -oE '[^ ]+ ~ .*' | awk -F~ '!seen[$1]++' | head -n 10 | awk -F' ~ HEAD@{' '{printf(\" \\033[33m%s: \\033[37m %s\\033[0m\\n\", substr($2, 1, length($2)-1), $1)}'` + * Reformat the recent changes as Markdown release notes `git release-notes` ≡ `git log --color --pretty=format:'%s%Cred%d%Creset' --decorate | sed -E 's/(.*) \\((\\#[0-9]+)\\)/* \\2: \\1/' | tac -` diff --git a/provisioning/playbook.yml b/provisioning/playbook.yml index 24aa7c8b..8575e688 100644 --- a/provisioning/playbook.yml +++ b/provisioning/playbook.yml @@ -145,7 +145,9 @@ cmp: '!git checkout master && git pull -p' cdp: '!git checkout develop && git pull -p' pop: 'stash pop' - # git needs the whole command below to be quoted so we use > to preserve quotes + # git needs the following commands below to be quoted so we use > to preserve quotes + lb: > + "!git reflog show --pretty=format:'%gs ~ %gd' --date=relative | grep 'checkout:' | grep -oE '[^ ]+ ~ .*' | awk -F~ '!seen[$1]++' | head -n 10 | awk -F' ~ HEAD@{' '{printf(\" \\033[33m%s: \\033[37m %s\\033[0m\\n\", substr($2, 1, length($2)-1), $1)}'" release-notes: > "!git log --color --pretty=format:'%s%Cred%d%Creset' --decorate | sed -E 's/(.*) \\((\\#[0-9]+)\\)/* \\2: \\1/' | tac -"