Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to discard changes to individual lines of a file?

Greg Burghardt October 15, 2018

One of the main reasons I use SourceTree is the ability to commit changes to individual lines of a file, or discard those individual changes.

After upgrading to 2.6.10 on Windows 10 I can't seem to find this functionality anymore.

In the diff pane you used to be able to select multiple lines, right-click and select "Stage selected lines" or "Discard selected lines." Now right-clicking on a selected line in the diff pane just deselects the line.

Similar question from 2016, but the UI has changed since then, so the accepted answer does not apply to this version of SourceTree: https://community.atlassian.com/t5/Bitbucket-questions/What-if-you-don-t-want-to-stage-commit-part-of-the-quot-hunk/qaq-p/116026

1 answer

2 votes
minnsey
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 22, 2018

Hi

When you select 1 or more lines in the diff view the Stage HunkDiscard Hunk buttons in the upper right of the diff view should change to Stage Lines, Discard Lines

Peter Wesley Hutcheson September 17, 2019

This functionality is so useful!

nymbus86 November 30, 2021

The problem is that when you scroll down within the diff view preview panel the Stage Lines / Discard Lines buttons become invisible. It would be best if you could have them fixed. I do understand that you can have more than one hunk per file (and even per multiple files selected), but I think you can still have those buttons visible while scrolling within the range of a hunk and have them slide up (or down) once the hunk from below (or above) reaches the top. I hope what I am saying is making sense.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events