简体   繁体   English

Git格式补丁查看器?

[英]Git format-patch viewer?

Somebody is sending me patches generated by "git format-patch". 有人正在向我发送由“git format-patch”生成的补丁。

Is there a gui (on linux) that can open these .patch files? 是否有一个gui(在Linux上)可以打开这些.patch文件?

I've tried many diff gui but all they do is compare two existing files/folders. 我尝试了很多差异,但他们所做的就是比较两个现有的文件/文件夹。 None can display the patch, except kompare which spits a "The diff is malformed. Some lines could not be parsed and will not be displayed in the diff view." 没有可以显示补丁,除了kompare,它吐出“差异格式错误。有些行无法解析,不会在差异视图中显示。” everytime. 每次。

I've made a tool to view diff side-by-side: https://app.box.com/s/l8rmp281aptq711fqwve 我已经制作了一个工具来并排查看差异: https//app.box.com/s/l8rmp281aptq711fqwve

Screenshot: 截图: 在此输入图像描述

Now it was updated to v0.4 to support file list. 现在它已更新到v0.4以支持文件列表。

They're pretty easy to read, but if you want to see the entire context of the file, the best way is to apply them with git-am : 它们很容易阅读,但是如果你想看到文件的整个上下文,最好的方法是用git-am来应用它们:

git am foo.patch
git difftool ORIG_HEAD

If you like it, it's already committed. 如果你喜欢它,它已经承诺了。 If not: 如果不:

git reset --hard ORIG_HEAD

The .diff and .patch files that git generates are just plain-text diff files. git生成的.diff.patch文件只是纯文本差异文件。

Most text editors on linux should be able to open and syntax-highlight the diff files. Linux上的大多数文本编辑器应该能够打开并语法突出显示diff文件。 Emacs and vim should be able to view them without any problem, as should gedit, kate, or pretty much any other syntax-highlighting text editor. Emacs和vim应该能够毫无问题地查看它们,就像gedit,kate或几乎任何其他语法高亮文本编辑器一样。

If you don't need syntax highlighting, less , cat , or anything else that displays plain text should also show you the changes. 如果您不需要语法高亮显示,则lesscat或显示纯文本的任何其他内容也应显示更改。

Git Cola includes an "Apply Patches" dialog that can be launched from the Actions menu, or via the git cola am sub-command. Git Cola包含一个“Apply Patches”对话框,可以从Actions菜单或git cola am子命令启动。 You can open patches in this dialog and display the contents with diff syntax highlighting. 您可以在此对话框中打开补丁,并使用diff语法突出显示内容。

This feature is available in master by cloning the repo and will be in the upcoming v3.3 release. 通过克隆repo可以在master使用此功能,该功能将在即将发布的v3.3版本中提供。

They are supposed to be human-readable text. 它们应该是人类可读的文本。 Open them in a text editor. 在文本编辑器中打开它们。

Edit: or apply the patch on a branch, then you can use whatever tool you normally use to compare branches. 编辑:或在分支上应用补丁,然后您可以使用通常用于比较分支的任何工具。

Edit 2: oh you already thought of that, never mind. 编辑2:哦,你已经想到了,没关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM