Git format-patch viewer?
Somebody is sending me patches generated by "git format-patch".
Is there a gui (on li开发者_开发问答nux) that can open these .patch files?
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." everytime.
I've made a tool to view diff side-by-side: https://app.box.com/s/l8rmp281aptq711fqwve
Screenshot:
Now it was updated to v0.4 to support file list.
Source code: https://github.com/megatops/PatchViewer
I found a solution:
cat patch | colordiff | less -RS
Further reading: http://www.markusbe.com/2009/12/how-to-read-a-patch-or-diff-and-understand-its-structure-to-apply-it-manually/ (archived copy)
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 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.
Most text editors on linux should be able to open and syntax-highlight the diff files. 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.
If you don't need syntax highlighting, less
, cat
, or anything else that displays plain text should also show you the changes.
Git Cola includes an "Apply Patches" dialog that can be launched from the Actions menu, or via the git cola am
sub-command. You can open patches in this dialog and display the contents with diff syntax highlighting.
This feature is available in master
by cloning the repo and will be in the upcoming v3.3
release.
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.
精彩评论