Github Desktop - "Discard modified lines" option greyed out
Asked Answered
G

2

7

I'm confused as to when I can actually use this option as it's always greyed out, whether the lines are highlighted or not.

enter image description here

Gretchengrete answered 14/8, 2021 at 11:55 Comment(0)
G
19

To discard a contiguous block containing both added and removed lines, you need to right-click the very narrow area between the line numbers and the +/- symbols. Otherwise the 'Discard modified lines' option is disabled.

This is where to click

When you have a block containing only one of added or removed lines, you can right-click on any individual line number and then discard that line from the menu. Alternatively you can use the same approach from above, first selecting multiple lines with the left mouse button, then right-clicking in the very narrow area to bring up the menu.

There is an open issue about this non-obvious UX here.

Gery answered 6/5, 2022 at 9:3 Comment(2)
Similarly, left-clicking that non-obvious area will allow you to de-select the entire modified block for the commit.Treble
Note that the location of the narrow area you must click has been moved in a recent update. See https://mcmap.net/q/1408023/-github-desktop-quot-discard-modified-lines-quot-option-greyed-out.Gery
G
0

In a recent update they have moved the location of the narrow gutter of pixels you must click in order to bring up the desired context menu. In contrast to my previous answer it is now located to the left of the line numbers.

2

Gery answered 26/4 at 17:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.