如何将git log(或svn log)限制为关于某个特定文件的修订版?

时间:2021-06-21 06:59:17

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.

我想看一个文件的一系列差异。我决定只将日志列表限制为仅修改文件的那些条目。

5 个解决方案

#1


15  

svn log filename

svn日志文件名

or

svn log URL

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

我还建议添加--limit N以仅显示最近的条目:

svn log main.cpp --limit 4

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

这些可以应用于文件或项目,BTW。

#2


11  

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

git log [filename]。如果你想看看改变了什么,git log -p [filename]。

#3


3  

SVN Log for a single file

SVN记录单个文件

svn log filename.php

svn log filename.php

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

SVN diff用于修订版本1033和1191之间的文件

svn -r 1033:1191 diff filename.php

svn -r 1033:1191 diff filename.php

#4


2  

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而言,如果当前版本中不存在相关文件,您还需要指定一个peg修订版:

svn log path@some_revision_where_the_path_existed

svn日志路径@ 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).

如果省略了peg修订版,则默认为HEAD(对于url)或BASE(对于工作副本路径)。

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.

另请注意,如果文件已被删除并随后复活而没有历史记录将其连接到旧文件(无论信不信,我已经看到这种技术在应用深度重构或技术转换时有充分理由应用),svn log将仅显示与该特定挂钩修订相关的更改。

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.

如果要查看与特定路径关联的所有更改,则必须执行存储库根目录的svn log -v,然后按更改的路径筛选结果。

#5


2  

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

Git:如果文件从当前分支中删除(或者被Git看作是一个模棱两可的参数):

git log -- [filename]

#1


15  

svn log filename

svn日志文件名

or

svn log URL

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

我还建议添加--limit N以仅显示最近的条目:

svn log main.cpp --limit 4

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

这些可以应用于文件或项目,BTW。

#2


11  

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

git log [filename]。如果你想看看改变了什么,git log -p [filename]。

#3


3  

SVN Log for a single file

SVN记录单个文件

svn log filename.php

svn log filename.php

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

SVN diff用于修订版本1033和1191之间的文件

svn -r 1033:1191 diff filename.php

svn -r 1033:1191 diff filename.php

#4


2  

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而言,如果当前版本中不存在相关文件,您还需要指定一个peg修订版:

svn log path@some_revision_where_the_path_existed

svn日志路径@ 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).

如果省略了peg修订版,则默认为HEAD(对于url)或BASE(对于工作副本路径)。

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.

另请注意,如果文件已被删除并随后复活而没有历史记录将其连接到旧文件(无论信不信,我已经看到这种技术在应用深度重构或技术转换时有充分理由应用),svn log将仅显示与该特定挂钩修订相关的更改。

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.

如果要查看与特定路径关联的所有更改,则必须执行存储库根目录的svn log -v,然后按更改的路径筛选结果。

#5


2  

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

Git:如果文件从当前分支中删除(或者被Git看作是一个模棱两可的参数):

git log -- [filename]