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

Re: how to trace the patch?

From
Linus Torvalds <torvalds@osdl.org>
Date
Apr 27, 2006, 15:55 UTC
Message-ID
<Pine.LNX.4.64.0604270843190.3701@g5.osdl.org>
In-Reply-To
<BAYC1-PASMTP029B6CB13A6C0BA3956E17AEBD0@CEZ.ICE>
On Thu, 27 Apr 2006, sean wrote:
Show 10 quoted lines
> 
> $ git log -- <filename>
> 
> To see a list of commits that affected the file you're interested in.
> 
> $ git log -p -- <filename>
> 
> Will include a diff after each commit showing you how the file was
> changed.  And if you want to see what other changes happened in each
> commit that modified your file, add "--full-diff" to the command above.

Side note: the "git log -p" thing only works with git 1.3.0+, and even without the "-p", old versions will be very slow.

So if you have anything older than 1.3.0, you're likely better off using "git whatchanged [-p] -- <filename>".

Also, regardless of which one you use, it's worth pointing out that:
 - for tracking multiple files, just use more than one filename, and you 
   can also use a directory name. 
 - you can combine this with all the normal revision limiting rules, which 
   is often useful when you know you're not interested in stuff you've 
   already seen.

For example, if you have just done a "git pull" and you noticed that a file (or set of files) you cared about changed - or you just wonder _if_ it changed - you can do something like

	gitk ORIG_HEAD.. -- drivers/scsi/ include/scsi/

to see what changed due to the pull within those files. Useful whether you're tracking certain subsystems, individual drivers, architectures, whatever.. It can be useful also just to split the logs up (ie maybe you're not interested in anything in particular, but you do a "git log" and see something that strikes your fancy, you can decide to see what _else_ changed in that area).

And instead of "gitk", use "git log -p" or "git whatchanged" or whatever. It's all the same thing, just different ways of looking at it.

		Linus
Previous: seanNext: Aubrey
Message 3 of 4 in “how to trace the patch?”
  1. AubreyApr 27, 2006
  2. seanApr 27, 2006
  3. Linus TorvaldsApr 27, 2006
  4. AubreyApr 27, 2006

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.