# What should a user expect from git log -M -- file

3 messages from 2009-11-26 to 2009-11-27. Participants: Mike Hommey, Jakub Narebski.
Thread: https://gitlist.dev/t/21763

## Mike Hommey, 2009-11-26 16:36

Subject: What should a user expect from git log -M -- file
Message-ID: <20091126163654.GA14509@glandium.org>
URL: https://gitlist.dev/e/20091126163654.GA14509%40glandium.org

```
Hi,

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 ?

Mike

```

## Jakub Narebski, 2009-11-26 17:14

Subject: Re: What should a user expect from git log -M -- file
Message-ID: <m3ocmpmcoq.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3ocmpmcoq.fsf%40localhost.localdomain
In-Reply-To: <20091126163654.GA14509@glandium.org>

```
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).

-- 
Jakub Narebski
Poland
ShadeHawk on #git

```

## Mike Hommey, 2009-11-27 07:28

Subject: Re: What should a user expect from git log -M -- file
Message-ID: <20091127072820.GA17045@glandium.org>
URL: https://gitlist.dev/e/20091127072820.GA17045%40glandium.org
In-Reply-To: <m3ocmpmcoq.fsf@localhost.localdomain>

```
On Thu, Nov 26, 2009 at 09:14:37AM -0800, Jakub Narebski wrote:
> 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

```
