[英]How to check revision history on specific file in git
My change got dropped in one of the file in git develop branch I used below command to to check on which commit to develop branch the changes got dropped 我的更改被放到了git development分支的文件之一中,我在下面的命令中使用它来检查更改被丢弃到哪个提交开发的分支
git log -p <filename>
but the output is not not showing clearly which commit to develop has broken it. 但是输出并没有清楚地表明开发的承诺已破坏了它。
Two points to consider: 需要考虑两点:
Git does not track file renames: it does not record them to the commit history, so a rename appears in a commit as a removal of the file with the old name and addition of the file with the new name. Git不会跟踪文件重命名:它不会将它们记录到提交历史中,因此重命名会出现在提交中,即删除具有旧名称的文件并添加具有新名称的文件。
So if your file got renamed, you have to exercise the Git's ability to detect renames/copies at the history traversal (that's what git log
does in the first place). 因此,如果文件被重命名,则必须行使Git的能力在历史遍历时检测到重命名/副本(这是git log
首先要做的)。 Look at the -M
and -C
command-line options of git log
for more info. 查看git log
的-M
和-C
命令行选项以获取更多信息。
There exists lesser-known features of git log
which are of immence power: the -S
, -G
and -L
options. git log
具有鲜为人知的强大功能: -S
, -G
和-L
选项。 (Also see the accompanying --pickaxe-all
and --pickaxe-regex
options). (另请参见随附的--pickaxe-all
和--pickaxe-regex
选项)。
These features allow for searching the history for the appearances or disappearances of particular bits of code, and more. 这些功能允许在历史记录中搜索特定代码位的出现或消失等等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.