Git format-patch viewer?

Someone sends me patches created by "git format-patch".

Is there a gui (on linux) that can open these .patch files?

I tried a lot of diff gui, but all they do is compare two existing files / folders. None of them can display a patch except kompare, which spits on "diff is wrong. Some lines cannot be parsed and will not be displayed in the diff view." everytime.

+8
source share
7 answers

They are fairly easy to read, but if you want to see the whole 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 done. If not:

 git reset --hard ORIG_HEAD 
+5
source

I made a tool to view diff side by side: https://app.box.com/s/l8rmp281aptq711fqwve

Screenshot: enter image description here

Now it is updated to version 0.4 to support the file list.

Source code: https://github.com/megatops/PatchViewer

+30
source

I found a solution:

 cat patch | colordiff | less -RS 

Additional information: http://www.markusbe.com/2009/12/how-to-read-a-patch-or-diff-and-understand-its-structure-to-apply-it-manually/

+6
source

The .diff and .patch created by git are plain text files.

Most linux text editors should be able to open and syntax highlight diff files. Emacs and vim should be able to view them without any problems, like gedit, kate, or almost any other text editor that emphasizes syntax.

If you don't need syntax highlighting, less , cat or anything else that displays plain text should also show you the changes.

+3
source

Git Cola includes an Apply Fixes dialog box that can be launched from the Actions menu or using the git cola am subcommand. You can open patches in this dialog box and display diff syntax highlighted content.

This feature is available in master by cloning the repo and will be in the next version v3.3 .

0
source

Suppose there is an earlier commit that you want to extract from its branch and affect the alternate branch.

git-format-patch export performs the commit as spot documents, which can then be placed in another branch or possibly cloned into the repository. Patch files indicate single dedication and Git repeats that are committed when importing the patch file.

git-format-patch will be the first step in a quick way to get changes from one copy of any repository to another. An old similar procedure, when Git was used locally, just without remote storage, sent spots by email to each other. This is available if you just need someone to make one commit without requiring branch merging, as well as overheads that complement.

git-am is a command that allows you to apply patches to the current branch. Am means "apply (out of) a mailbox" because it was created using hotfixes by email. A useful aspect of git am is that it uses this place as a commit, which means you don’t have to lift your finger after running the load more .... command .

0
source

They should be human-readable texts. Open them in a text editor.

Edit: or apply a patch to a branch, then you can use any tool that you usually use to compare branches.

Edit 2: oh, you already thought about it, it doesn't matter.

-3
source

Source: https://habr.com/ru/post/894332/


All Articles