-
-
Notifications
You must be signed in to change notification settings - Fork 580
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
Per line staging #59
Comments
Hi @non-descriptive thanks for your interest in |
Lazygit does this via space. You can keep pressing space on changed lines and they'll get staged. (Same for unstage) It's pretty smooth. |
Hmm nice. In tig you can do '/' for break this hunk into two hunks but for some reason there are some hunks it refuses to split. Pressing space would work but being able to split a hunk at an arbitrary line would be great. Worst case you have to split twice to get at a specific line, but best case far less keystrokes (and tig compatibility). |
Using I use gitup on macos (gui) and I always select exact lines with the mouse and press enter to stage. There does not seems to be a limit of split in gitup so it's probably a different mechanism behind the scene. I would love to be able to select exact lines to stage! |
This is one of the most important features for me regarding the use of a git client versus using git directly from the command line! |
In tig you can stage an individual line from the unstaged diff by moving the cursor over it and hitting |
Sometimes I find it useful to edit a hunk-diff in a text editor. However, most GUI Git clients don't expose that option, only |
I think |
I'd vote also for Space instead of "1", since "1" is already a keystroke to change "window". |
Any key to stage an individual line would be a huge improvement for me to finally be able to ditch "git gui" and stop mousing around 🥳 For vim users, Shift+v would be a familiar hotkey to start selecting lines. Thank you for gitui! 😃 |
super excited for this feature, that's probably the only thing which stopps me to switch to gitui from vim-fugitive :) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Here is some activity. |
It's already possible to select the lines using Shift+Arrow Down/Up on Windows. Would be nice if one could stage selected lines using Space. |
@ser-drephs unfortunately its not trivial and did not bubble up high enough apparently for anyone who cares to go forward providing a PR :( |
ok work has begun on this! this will come in shape of actually four similar features:
I found an inspiration that supports this and is based on libgit2: nodegit - it seems surprisingly complicated - this is actually the only open source example that implements those per-line operations based on libgit2 and it has a few shortcomings that I am planning to lift: no support to stage/discard lines of untracked files and no line edits across multiple hunks |
ok some progress: support for staging/unstaging changes in a tracked file: see #575 |
It's visible on the record that you press shift to select lines, but it looks like it doesn't really displayed in the actual UI. Is it possible to change "Scroll" caption when any of modifier keys pressed? If so, it might be a good idea to land an issue that depends on the current one. |
true the line selection is not yet represented in the command bar at the bottom |
I consider this done now, the remaining two tasks (which I consider less important) will be tackled in a followup later: #582 |
@extrawurst great addition! will you publish a new release with this feature? |
Yeah it’s scheduled for 0.13 and I am asking for more people to try it until then by building from master to make sure it’s as solid as possible |
Just tried it for say, 2 minutes, and it works well! I'll continue to use it tonight and tomorrow. I'll report if I find a problem. Thanks a lot!! |
So I've used b5ef9b1 today. Works well! Good job :) The only detail I can say, and that's a nitpick, is that when I stage a line, the "line cursor" (for a lack of better term...) moves to the top of the hunk. When the hunk is large and that a couple of lines are staged, it can be annoying to move the cursor back close to the original location. Otherwise, thank you!! |
this is a very good point: #583 |
@nbigaouette i just merged this into master - would love to get your feedback on this! see #583 |
Excellent! Just tried it and yes, cursor stays at proper location. Good job!! Found another bug with the line staging. If I stage all lines of a hunk line by line, I end up with a hunk that has no diff but is still present in the diff window (it should disappear, like when you stage a whole hunk). |
Well that’s probably only a left-over whitespace change. Should be the same if u just insert a newline in some file. Such single newline changes are not well visualized yet. But that’s not a new issue |
True! Was only whitespaces. Thanks! |
Currently we can stage things only hunk by hunk or whole file at once. It would be nice to have ability to stage only current line or bunch of selected lines.
Flow would look like something like this:
We focus on diff panel and navigate to a hunk we want to work with.
Select lines we want to stage with arrows and some modifier key (is tui allow that kind of thing?) and press [S]tage button. If there were no selection stage current line.
Inspired by git-cola behavior, but it's a gui app.
The text was updated successfully, but these errors were encountered: