如何获取 git 存储库中特定文件的更改历史记录
我想做类似的事情:
git history my_file
可能的输出
2010-05-16
+ add this line
+ more code here
2010-05-15
+ delete code below
- bad code
- more bad codd
2010-05-12
+ changes made here
I would like to do something like:
git history my_file
possible output
2010-05-16
+ add this line
+ more code here
2010-05-15
+ delete code below
- bad code
- more bad codd
2010-05-12
+ changes made here
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试:
Try:
最接近您想要的内容是来自
git log
:-p
: 正如 Charles Bailey 在 他的答案:生成补丁-U0
:使用 0 行上下文(而不是通常的三行)生成差异。--pretty=format:%ai
:在补丁输出之前添加作者日期,ISO 8601 格式。例子:
The closest to what you want would be, from
git log
:-p
: as Charles Bailey mentions in his answer: Generate patch-U0
: Generate diffs with 0 lines of context instead of the usual three.--pretty=format:%ai
: precede the patch output with the author date, ISO 8601 format.Example:
如果将文件传递给 gitk(随 Git 安装一起提供),还会提供文件历史记录的漂亮 UI 视图。
在 Windows 上...
A nice UI view of the file history is also given if you pass the file to gitk, which comes with your Git installation.
On Windows...