git recent branch work
My bash alias:
alias git-recent-branch-work="git for-each-ref --count=30 --sort=committerdate refs/heads/ --format='%(refname:short)'"
Is even better as a native git alias and really easy to set up. In ~/.gitconfig
:
[alias]
recent-branch-work = for-each-ref --count=30 --sort=-committerdate --format='%(refname:short)' refs/heads/
Or if you don’t want to touch an editor, just call:
git config --global alias.recent-branch-work "for-each-ref --count=30 --sort=committerdate refs/heads/ --format='%(refname:short)'"
so now I call git recent-branch-work
to see what branch I was most recently working on.
In all my time using git I hadn’t realised it was so easy to set up these kinds of git subcommands. Definitely a case of RTFM!
All links, in order of mention:
- all my time using git: https://gist.github.com/jaygooby/2762353
- RTFM: https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases
Recent posts:
- Patch for aarch64 (aka arm64) openssl 1.0.2 'relocation R_AARCH64_PREL64 against symbol OPENSSL_armcap_P error'
- TIL: the `NO_COLOR` informal standard to suppress ANSI colour escape codes
- Copy the contents of a branch into an existing git branch without merging
- Adding search to a static Jekyll site using pagefind
- asdf, python and automatically enabling virtual envs