# how to display file history?

3 messages from 2006-05-15 to 2006-05-15. Participants: Brown, Len, Shawn Pearce, Linus Torvalds.
Thread: https://gitlist.dev/t/4141

## Brown, Len, 2006-05-15 05:52

Subject: how to display file history?
Message-ID: <CFF307C98FEABE47A452B27C06B85BB670F4F8@hdsmsx411.amr.corp.intel.com>
URL: https://gitlist.dev/e/CFF307C98FEABE47A452B27C06B85BB670F4F8%40hdsmsx411.amr.corp.intel.com

```
it is tiresome to access kernel.org/git tree display
to see the list of commits that changed a particular file.
(and for files on my local disk, this isn't available).

How do I print the list of commits that change a particular file
on my local disk?

thanks,
-Len
 

```

## Shawn Pearce, 2006-05-15 06:00

Subject: Re: how to display file history?
Message-ID: <20060515060054.GA28252@spearce.org>
URL: https://gitlist.dev/e/20060515060054.GA28252%40spearce.org
In-Reply-To: <CFF307C98FEABE47A452B27C06B85BB670F4F8@hdsmsx411.amr.corp.intel.com>

```
"Brown, Len" <len.brown@intel.com> wrote:
> it is tiresome to access kernel.org/git tree display
> to see the list of commits that changed a particular file.
> (and for files on my local disk, this isn't available).
> 
> How do I print the list of commits that change a particular file
> on my local disk?

I'm confused - why aren't these available on your local disk?  Do you
not have a clone of the kernel repository local?  If you don't have
a clone you aren't really going to be able to get a history.

But assuming you had one use whatchanged:

	git whatchanged A

will show only the commits which affected file A, listing them in
reverse order (most recent to oldest).

-- 
Shawn.

```

## Linus Torvalds, 2006-05-15 15:15

Subject: Re: how to display file history?
Message-ID: <Pine.LNX.4.64.0605150811400.3866@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0605150811400.3866%40g5.osdl.org
In-Reply-To: <CFF307C98FEABE47A452B27C06B85BB670F4F8@hdsmsx411.amr.corp.intel.com>

```


On Mon, 15 May 2006, Brown, Len wrote:
>
> it is tiresome to access kernel.org/git tree display
> to see the list of commits that changed a particular file.
> (and for files on my local disk, this isn't available).
> 
> How do I print the list of commits that change a particular file
> on my local disk?

Just do

	git whatchanged -p <file>

which has worked pretty much since day one. In fact, it's much better than 
that. The "file" can be any abritrary combination of files and/or 
directories, and it will track them all at the same time. So

	git whatchanged -p arch/ia64 include/asm-ia64

will track the ia64-specific changes.

Newer git versions (ie 1.3.x+) support this in "git log" too (it worked on 
older gits, but it was unacceptably slow, so you might as well consider it 
"nonworking"). So

	git log [-p] <filespec>

is your friend.

Finally, as usual, "gitk" is just a fancier log viewer. So just do

	gitk arch/ia64 include/asm-ia64

and enjoy.

You really shouldn't go to gitweb. The history view of gitweb is much less 
capable than any local view.

		Linus

```
