git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Which file is older in history?

From
Jeff King <peff@peff.net>
Date
Mar 21, 2013, 13:26 UTC
Message-ID
<20130321132620.GB23162@sigill.intra.peff.net>
In-Reply-To
<CALkWK0nOzUXk0cFh8GCHc=YqLkRJ2XNFgU_tOsua81ROK99mXw@mail.gmail.com>
On Thu, Mar 21, 2013 at 06:02:32PM +0530, Ramkumar Ramachandra wrote:
Show 5 quoted lines
> >   git log --format=%H --name-status --diff-filter=A -- path1 path2 |
> >   grep ^A |
> >   tail -1
> 
> Great!  I just learnt about --name-status now.
You can also use "--name-only", but the parsing is a little less robust.
> Nit: tail -<n> is deprecated in favor of tail -n <n>, I think.  It's
> nicer to have definite fixed command line options, as opposed to
> parsing an arbitrary -(*) and deciding if \1 is a \d+.

Yeah, POSIX has always specified "-n" for tail, as well as for head. I remember in the late 90's and early 00's running into systems where POSIX "head -n" did not work, and you _had_ to use "head -1". I don't recall now if that was the case for tail, too, nor what system that was on (but if I had to guess, I'd say pre-Solaris SunOS).

So yeah. Using "tail -n 1" is probably a better idea in the long run.
-Peff
Previous: Ramkumar Ramachandra
Message 7 of 7 in “Which file is older in history?”
  1. Ramkumar RamachandraMar 20, 2013
  2. Junio C HamanoMar 20, 2013
  3. Ramkumar RamachandraMar 21, 2013
  4. Jeff KingMar 21, 2013
  5. Jeff KingMar 21, 2013
  6. Ramkumar RamachandraMar 21, 2013
  7. Jeff KingMar 21, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.