如何在Git中跟踪单个文件的历史时查看完整提交? [英] How to view complete commits when tracking history of a single file in Git?

查看:239
本文介绍了如何在Git中跟踪单个文件的历史时查看完整提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Git仓库,里面有大约两年的历史。我有一个单独的文件,为此我希望找到所有提交,并为每个提交:所有其他提交的文件。我们假设这个文件名为file.txt。我可以用这个文件作为参数运行gitk:

I have a Git repository with about a two years of history in it. I have single file in it, for which I wish to find all the commits, and for each commit: all the other files that were committed in it. Let's assume this file is named file.txt. I can run gitk with this file as argument:

gitk file.txt

我确实得到了每个提交。但是,在gitk中浏览该树只会显示对file.txt所做的更改。我想看看该提交中更改了哪些其他文件。我可以复制粘贴每个提交SHA1并显示它,但有超过数百个与此文件相关的提交。

and I do get each commit. However, browsing that tree in gitk only shows changes done to file.txt. I'd like to see what other files were changed in that commit. I can copy paste each commit SHA1 and display it, but there are over hundred of commits related to this file.

我注意到右下角部分的comments部分的屏幕是空的(只显示文字评论)。也许可以在那里显示一个文件列表?

I notice that "comments" section in bottom-right part of screen is empty (only shows text "Comments"). Maybe a list of files could be shown there?

推荐答案

在命令行中,

In the command line,

git log -p --full-diff file.txt

会输出你想要的东西。

如果你必须在gitk中看到它,用 no 参数调用它,触摸路径file.txt,并提交包含该文件将是粗体。您可以使用向上和向下按钮遍历它。

If you must see it in gitk, invoke it with no arguments, find commit "touching path" file.txt, and the commit contains that file will be bold. And you can use the "up" and "down" buttons to traverse through it.

这篇关于如何在Git中跟踪单个文件的历史时查看完整提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆