-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to revert single files/hunks/lines #7
Comments
Here's a way to at least check out files: [
{ "caption": "-" },
{
"caption": "Reset file to this version",
"command": "git",
"args": {"argv": ["checkout", "$commit", "$path"]}
}
] Save in your user folder as File.sublime-menu. |
Reversing/reverting hunks and selected lines are the only features keeping me from switching from SourceTree. |
Workaround for reverse hunk: |
Isn't this usually a problem of having committed unrelated changes within the same commit previously? If a hunk could work on it's own it should have been committed as a single commit in the first place... While it may come in handy, it may promote not committing atomic changes. If you need to revert a hunk, you should probably revert the complete commit without yet committing it, then only stage the hunks that need to be reverted, commit, then discard the rest. So I think it could be useful to have a context menu item "Revert without committing" aka |
No. What if you made a fix for an issue which containes many code lines. During review another guy finds a regression in maybe one or two lines, which he wants to revert. This might not be an everyday scenario, but I was sometimes faced to it here and there.
|
This has been added in dev build 2024! |
Nice job. |
Problem description
If a bug was found being introduced by a commit, it might be useful to be able to revert the causing file, hunk or even just a single line of code. This can be required as a temporary solution until a better fix is available or to remove a regression. It would at least help complete all functions like (stage/stash/revert/...) supporting all kinds of operation in the same way.
Preferred solution
The command should work like staging files. Means select single folders, files, hunks or lines to revert.
The hunk header of a committed file currently just shows the "hunk history" button. Maybe the hunk header could be turned into a toolbar containing things like
Selecting single lines within the hunk should then change the buttons to
The commands should be able to be bound to user defined keys as well.
Such a toolbar could make use of glyphs/icons instead of text to keep the button size as compact as possible. A description of the action can be displayed as tooltip if the button is hovered. The buttons might be hidden in the same way as the current "hunk history" button.
The text was updated successfully, but these errors were encountered: