Non-interactive git restore for specific lines in a file

45 Views Asked by At

I have a modified and not staged file myfile.txt.

I want to git restore (or git checkout) myfile.txt, but it must undo the modifications done only within the line range 15-17. How to do that?

I've some solution by using interactive -p option, but I am not interested in this approach as I already know the line range I want to undo modifications.

1

There are 1 best solutions below

0
j6t On

There is no built-in mode of git restore that would allow you to undo a change partially in a non-interactive way.