Re: Listing files in order they are changed
- From
Jeff King <peff@peff.net>
- Date
- Sep 23, 2010, 20:38 UTC
- Message-ID
- <20100923203814.GA10951@sigill.intra.peff.net>
- In-Reply-To
- <AANLkTimHrCujEggj9KbAWWivY+WxnL0YqsXs+idhymBA@mail.gmail.com>
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