Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How would I discard multiple, but not ALL hunks in a single file?

For example I have file with 67 'hunks' and I only want to keep 3 of them to stage and commit. Do I need to click 'Discard Hunk' 64 times to do this or is there an easier way?

1 answer

This might be too late but i just had the same issue with iOS storyboards, if you click the icon above "discard hunk" (circle with three dots and a down arrow) and choose external diff then when your diff opens select all ctrl-a/cmd-a and using the selection drop down on the bottom right choose ALL from your remote repo, then go back through and choose YOURS on the 3 you want to keep, save and close and the diff is updated. Hopefully this helps someone

I found an even easier way to do it. Click any line you want to commit (you can click and drag to select multiple lines) then right click and choose "Stage selected lines"

Suggest an answer

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

Bug Fix: Sourcetree for Windows authentication error when updating to app password

Hello Sourcetree users!!! With the recent removal of Bitbucket Cloud account passwords for app passwords (please see our Bitbucket Cloud community post for details on why we made this change for se...

61,937 views 127 27
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