How to create a patch for a single (or selected) file?

I cannot seem to find a way to create a patch (or diff) for a subset of files for a commit.

Environment:

  • Sourcetree 2.6.3 (134) for Mac (OS X Sierra)
  • Git repository on BitBucket

Scenario:

  1. Large commit containing many changes
  2. In History View, I right click on the most recent commit and select "Create Patch..."
  3. Patch window appears.  In the history pane of the patch window I select the version I want to generate the diff (patch) from
  4. In the files window (lower left of the patch window) I select only the files for which I want to view
  5. This works for VIEWING the diffs (it only shows the diffs for the selected files) but when I click "Create" to create the patch file, the patch shows ALL files that have changed

How do I create a patch (diff) file for only the selected files?

1 answer

I'm afraid there isn't an option to create patch per file or for individual files in commits. This is possible only if the changes are not committed. 

Feel free to submit an enhancement request on jira.atlassian.com for the Sourcetree team to consider this feature in a future release. 

Thanks,
Manjunath
Sourcetree Mac Developer

Suggest an answer

Log in or Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

261 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot