Add support for creating patches from File Compare

Martin Stolpe 3 years ago updated 3 years ago 6

I have some local commits for a file and wanted to create a patch file which contains the differences to the remote version of the file. When I select the two revisions in the Log view window I can open a File Compare which lists the changes. It would be nice if there was an option in the File Compare view to then create a patch file with the changes.


Currently, you have 2 Options:

- create a tiny script that invokes git diff > patch and add this as external tool (https://stackoverflow.com/questions/5159185/create-a-git-patch-from-the-changes-in-the-current-working-directory#15438863)

- stash the changes and create the patch from the stash commits

Thank you for your suggestions. I have already commited the changes to my local repository but did not push the changes. So what I want to do is to create a patch file which includes the changes from several commits (in my case from the last pulled commit to my current local head revision).

Have you tried to select both commits in the log - the last commit and the remote commit?

Here is a screenshot of what I have done so far.

In the Files section it is possible to show the changes but I did not find an option to create a patch out of these changes.

I'm not sure about your suggestion about the stash. Normally I would stash changes which I haven't commited yet. Could it also help me here to create a Patch and if so how?

Please try the context menu of the "Commits" view, not the "Files" view.