To put things into context of why I am asking this, git-gui has a 
feature where you can select parts of a displayed diff, and can 
stage/unstage those parts. That feature is implemented in git-gui by 
just generating a diff from the selected lines, and then applying it. 
Check git-gui/lib/diff.tcl:643 for the implementation.

Now, I want to add a similar feature, but one that discards/resets the 
selected lines. And I'd like to avoid the hack that git-gui's 
apply_range_or_line is. So, is there a cleaner way to do this that does 
not involve generating a diff and then applying it?

Also, if there is a better way of staging and unstaging selected lines 
as well, do let me know, and I will try to fix git-gui's hacky way of 
doing it.

Pratyush Yadav

Reply via email to