git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Branch list by date
@ 2014-07-08  4:54 Jeremy Apthorp
  2014-07-09  5:21 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Jeremy Apthorp @ 2014-07-08  4:54 UTC (permalink / raw)
  To: git

I built this terribly-written alias because I wanted to see a list of
branches by date of commit. The output looks like this:

$ git bbd
  11 months ago  pipette_editor
    7 weeks ago  ensure-ie-rendering-edge
    6 weeks ago  strings-yml
    5 weeks ago  message-when-validation-fails
    4 weeks ago  new-parsers
    11 days ago  tax
    8 hours ago  search
    7 hours ago  browse
 16 minutes ago  master
  8 seconds ago  org-read

And the alias, in all its glory:

[alias]
  bbd = "!export head=$(git symbolic-ref HEAD); git for-each-ref
--sort=committerdate --format 'color=$(if [[ %(refname) = $head ]];
then printf \"\\e[32m\"; fi); printf \"\\e[01;30m%%15s\\e(B\\e[m
%%s%%s\\n\" %(committerdate:relative) $color %(refname:short)'
refs/heads/ --shell | sh"

I write this missive with dual purpose: firstly to share a potentially
useful tool, and secondly to suggest that this feature (with a less
mind-wrenchingly disgusting implementation) might be included in
mainline git, as for example `git branch [-t] | [--by-time]`.

Until the ocean swallows us all,
j

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Branch list by date
  2014-07-08  4:54 Branch list by date Jeremy Apthorp
@ 2014-07-09  5:21 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2014-07-09  5:21 UTC (permalink / raw)
  To: Jeremy Apthorp; +Cc: git

On Mon, Jul 07, 2014 at 09:54:55PM -0700, Jeremy Apthorp wrote:

> I write this missive with dual purpose: firstly to share a potentially
> useful tool, and secondly to suggest that this feature (with a less
> mind-wrenchingly disgusting implementation) might be included in
> mainline git, as for example `git branch [-t] | [--by-time]`.

I think what we should aim for is:

  1. Teaching git-branch the same sorting as for-each-ref. So first
     --sort, and then possibly "-t" as an alias for "--sort=committerdate".

  2. Teaching git-branch custom output formats. We have "-v" and "-vv",
     but it should support the full power of for-each-ref's --format
     atoms.

  3. Teach branch and for-each-ref to support readable colors in their
     formats, like we do for "log --format".

  4. Optionally add config options to configure defaults for the above,
     so "git branch" shows what you want.

I'm (slowly) working on a refactor that will unify for-each-ref and
branch, which would accomplish (1) and (2).

-Peff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-09  5:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-08  4:54 Branch list by date Jeremy Apthorp
2014-07-09  5:21 ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).