Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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.


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


  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

0 votes
Manju Atlassian Team Dec 22, 2017

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 for the Sourcetree team to consider this feature in a future release. 

Sourcetree Mac Developer

Hi Manju, how can it be done if the changes are not committed?
Should the file(s) be staged first?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

7,235 views 5 14
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you