Comments (30)
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!
from gitui.
ok work has begun on this! this will come in shape of actually four similar features:
- discard unstaged modified lines
- stage/unstage modified lines
- discard untracked lines
- stage/unstage untracked lines
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
anyhow, stay tuned, discarding lines is on its way:
from gitui.
Hi @non-descriptive thanks for your interest in gitui
! I would love to have this feature. I need to checkout options how to make this ergonomic using keyboard only. will checkout how other tools are doing this and come up with a plan!
from gitui.
Here is some activity.
from gitui.
In tig you can stage an individual line from the unstaged diff by moving the cursor over it and hitting 1
. You can unstage an individual line from the staged diff in the same way.
from gitui.
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.
from gitui.
I consider this done now, the remaining two tasks (which I consider less important) will be tackled in a followup later: #582
from gitui.
super excited for this feature, that's probably the only thing which stopps me to switch to gitui from vim-fugitive :)
from gitui.
ok some progress: support for staging/unstaging changes in a tracked file:
see #575
from gitui.
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.
this is a very good point: #583
from gitui.
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! 😃
from gitui.
staging/unstaging in tracked files is merged. please give it a spin💪
from gitui.
@extrawurst great addition! will you publish a new release with this feature?
from gitui.
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!!
from gitui.
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!!
from gitui.
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.
from gitui.
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).
from gitui.
Using git add -p
you can split a hunk but there is a limit to this split; this looks similar to what tig does.
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!
from gitui.
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 git add -p
from the command line. Additionally it's tedious to replace leading -
or +
with a single space.
from gitui.
In tig you can stage an individual line from the unstaged diff by moving the cursor over it and hitting 1. You can unstage an individual line from the staged diff in the same way.
I think 1
is a natural and easy to memorize key for this.
from gitui.
I'd vote also for Space instead of "1", since "1" is already a keystroke to change "window".
from gitui.
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.
from gitui.
@ser-drephs unfortunately its not trivial and did not bubble up high enough apparently for anyone who cares to go forward providing a PR :(
from gitui.
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.
from gitui.
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.
true the line selection is not yet represented in the command bar at the bottom
from gitui.
@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
from gitui.
@nbigaouette i just merged this into master - would love to get your feedback on this! see #583
from gitui.
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).
from gitui.
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
from gitui.
True! Was only whitespaces.
Thanks!
from gitui.
Related Issues (20)
- Not able to commit with predefined (template) commit message HOT 3
- Only show line-break visualization if the surrounding lines are not also newly added/removed
- diff on rename misleading HOT 1
- upcoming problem with bitflags and key_list ron reading HOT 6
- Syntax highlight theme on Files tab HOT 1
- make test fails on windows
- Pre-push hooks seem to be ignored HOT 1
- Cannot modify line-break HOT 2
- cargo fmt now messes things up on windows
- Better conflicts flow
- Page Up/Down buttons are not scrolling in Status and Files tabs HOT 1
- View combined directory diff / multiple files
- How to focus panes rather than move into them? HOT 2
- File autofocus fails on embed folders HOT 2
- Unable to switch tab using number row HOT 3
- show newer commits if on detached head
- PATH not respected in hooks HOT 6
- Can't fetch/pull on WSL
- listen for SIGINT signal instead of exit key bind HOT 4
- Stashing.FilesToStash window disappears after History/Blame
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gitui.