Create
cancel
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 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

0 votes

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
TAGS
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...

5,738 views 4 12
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