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

Re: What should a user expect from git log -M -- file

From
Mike Hommey <mh@glandium.org>
Date
Nov 27, 2009, 07:28 UTC
Message-ID
<20091127072820.GA17045@glandium.org>
In-Reply-To
<m3ocmpmcoq.fsf@localhost.localdomain>
On Thu, Nov 26, 2009 at 09:14:37AM -0800, Jakub Narebski wrote:
Show 22 quoted lines
> Mike Hommey <mh@glandium.org> writes:
> 
> > I recently reorganized a project of mine, and the result is that a lot of
> > files moved from the top directory to a sub directory.
> > 
> > Now, I innocently tried to 'git log -M' some of these files in the
> > subdirectories, and well, the history just stops when the file was
> > created. Obviously, if I put both the old and the new location it works,
> > but shouldn't users expect 'git log -M -- file' to try to find the
> > previous path and continue from there ?
> 
> What you want is not
> 
>   git log -M -- file
> 
> but
> 
>   git log --follow file
> 
> "git log -M -- file" IIRC first applies path limiting, simplifying
> history, *then* does rename detection, and finally filters output
> (unless --full-diff is used).

That's what I was looking for, thanks. I would suggest to put --follow closer to -M and -C in the documentation, but the way the git-log manual is generated (including diff options) makes that impossible :(

Mike
Previous: Jakub Narebski
Message 3 of 3 in “What should a user expect from git log -M -- file”
  1. Mike HommeyNov 26, 2009
  2. Jakub NarebskiNov 26, 2009
  3. Mike HommeyNov 27, 2009

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.