Reputation: 174457
Is it possible to stage only part of a line?
Scenario: I am refactoring my unit tests from Rhino.Mocks to NSubstitute, so I am changing a lot of code like this:
mock.AssertWasCalled(x => x.MyMetod());
to this:
mock.Received().MyMetod();
Now, I am not finished with this refactoring, but while I am at it, I come across a typo in one of my methods and fix it, so the code will look like this:
mock.Received().MyMethod();
Now, the renaming of this method is completely unrelated to the refactoring from Rhino.Mocks to NSubstitute, so I just would like to commit this change in its own revision. Is this possible somehow?
Upvotes: 4
Views: 145
Reputation: 1328322
Considering there is no telling how much you already modified your code, I would rather:
reset --hard HEAD
(make sure you don't have non-indexed changes, as in "changes only on your hard drive, never added to a Git repo": they would be deleted)MyMetod
call that your pending changes were still usingUpvotes: 1