tags:

views:

1397

answers:

5

I'd like to see a series of diffs for a file. I'd settle for simply the log listing restricted to only those entries that modified the file.

+6  A: 

git log [filename]. If you want to see what changed, git log -p [filename].

Ant P.
+2  A: 

SVN Log for a single file

svn log filename.php

SVN diff for changes on a file between revision 1033 and 1191

svn -r 1033:1191 diff filename.php

Zoredache
+4  A: 

svn log filename

or

svn log url

I also recommend adding --limit N to show only recent entries

svn log main.cpp --limit 4

These can be applied to a file or project, btw.

theschmitzer
D'oh; it's right there in the help files. I missed it in both.
James A. Rosen
Piping through less has a similar effect to --limit N: "svn log main.cpp | less"
James A. Rosen
+1  A: 

As far as SVN is concerned, if the file in question does not exist in the current revision, you would also need to specify a peg revision:

svn log path@some_revision_where_the_path_existed

If the peg revision is omitted, it defaults to HEAD (for a url) or BASE (for a working copy path).

Also note that if the file has been deleted and subsequently resurrected without history connecting it to the older file (which, believe it or not, I have seen this technique applied with good reason when a deep refactoring or technology shift is applied), the svn log will only show the changes associated with that particular peg revision.

If you want to see all of the changes that have ever been associated with a particular path, you have to do an svn log -v of the repository root and then filter the results by changed path.

Thomas S. Trias
+1  A: 

GIT: In case the file is deleted from current branch (or otherwise is seen as an ambiguous argument by git)

git log -- [filename]

mkorpela