Re: [Question] How to know which branch(ref) is the latest updated branch?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"lilinchao@xxxxxxxxxx" <lilinchao@xxxxxxxxxx> writes:

> In a git based workflow, there are usually many active branches.
> So, is there a convenient way to quickly know which branch is the
> latest updated?

These days "git branch" has "--sort" option, inherited from "for-each-ref",
so

    git branch --sort=-committerdate

lists them from the most-recently-committed [*].

HOWEVER.

There is no way to sort on the time when each branch was last
updated.  You may do

    git branch newbranch HEAD@{2.years.ago}

to create a new branch (i.e. it is the last updated branch) that
points at a commit that existed 2 years ago (hence it would be at
least 2 years old, possibly more).  If for-each-ref learns a new
placeholder %(reflogtime) that can be used to represent the
timestamp of the latest reflog entry, you should be able to sort by
the time when branch was last updated, but not until then.


[Footnote]

I have this handy alias

    [alias]
    notyet = branch --no-merged jch --no-merged seen --sort=-committerdate '??/*'

to remind me of topics that are not yet in my integration branches
while rebuilding them.

In the end result, 'seen' is supposed to include "everything I saw
and found possibly interesting", and 'jch' is supposed to be a
subset of it, but explicitly saying "show branches that are not in
either of these two" helps while rebuilding them (and I do so a few
times a day).



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux