Re: Listing files in order they are changed

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

 



On Thu, Sep 23, 2010 at 11:51:56AM -0700, Parag Kalra wrote:

> Is there a way I can make Git list all the trackedÂfiles in the
> working directoryÂin order they are changed (modified, added or
> deleted)

It's a somewhat expensive operation, since you have to walk history
backwards looking at changes. But try:

git log --pretty=format: --name-only |
  grep . |
  perl -ne 'print unless $seen{$_}++'

which will walk history backwards, printing out each filename the most
recent time it is encountered. Which should give you a list of all files
in the repo (including ones which no longer exist!), in order of most
recent to oldest.

If you want to restrict only to existing files, you would have to do
some clever path-limiting, or parse the results with a slightly smarter
perl script.

You can also tweak the definition of "most recent" by using --topo-order
or --date-order with git log.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]