tig
tig copied to clipboard
Reset single diff line
I'm searching for a key binding that would revert a single line:
The keybinding 1
stages a single line
The keybinding !
: Checkout file with unstaged changes. This will reset the file to contain the content it had at last commit.
Is they a way to reset only one line of a file which has many changes?
It would make sense to me to map this keybinding with the key 2
After looking inside the code:
case REQ_STATUS_REVERT:
if (!stage_revert(view, line))
return REQ_NONE;
break;
case REQ_STAGE_UPDATE_LINE:
if (stage_line_type == LINE_STAT_UNTRACKED ||
stage_status.status == 'A') {
report("Staging single lines is not supported for new files");
return REQ_NONE;
}
if (line->type != LINE_DIFF_DEL && line->type != LINE_DIFF_ADD) {
report("Please select a change to stage");
return REQ_NONE;
}
if (!stage_update(view, line, TRUE))
return REQ_NONE;
break;
in src/stage.c
, I would say it's not possible yet to add a keybinding for this.
That's true. There's no way to undo or revert a single line.
SourceTree can do this and it's a great feature. Cleaning up files out off debug lines at the same completing changes to commit. Any chances for implementation of this?
I have this in my .tigrc , maybe that could help you :
bind status r !git checkout --patch -- %(file)
When pressing r over a file name, it will open the patch interface of git to reset the changes you want
i second @psprint's motion
I usually just have to revert a single line with a TODO
or something like that. I find myself reverting a single line more often than using the single line stage option (unless I am working around the inability to revert that line).
+1 for this feature
+1 for this
I need this feature too.
And I found an solution which needs two steps:
-
\
to split the current chunk which splits a chunk into multiple tiny chunks, - then
status-revert
(by default it is!
) this chunk
Not sure if this works for all this kind of demand.