Skip to content

Commit

Permalink
Add git lb alias to view recent branches (#682)
Browse files Browse the repository at this point in the history
Helps if you have a lot of branches.
  • Loading branch information
freemanjp authored Apr 27, 2020
1 parent 3892940 commit 9b0d054
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion docs/_docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 -`
Expand Down
4 changes: 3 additions & 1 deletion provisioning/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -"
Expand Down

0 comments on commit 9b0d054

Please sign in to comment.