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)
- Allow reset to branch in branches view HOT 3
- List Remotes Popup HOT 4
- Signing implementation currently not interchangeable (impl trait return) HOT 1
- sign tags HOT 1
- git push fails but works fine with "git push"
- Cannot commit with empty e-mail. HOT 2
- Allow opening files from gitui from within the parent process rather than spawning a new one with vim HOT 1
- Can GitUI support diff-so-fancy? HOT 2
- gitui pulls a yanked dependency when installing with cargo HOT 5
- Support defaultKeyCommand for [gpg "ssh"] setting
- Automatic publishing to Winget HOT 1
- [ssh signing] support custom signing program HOT 2
- Fetch Failed: Repository Not Found
- Support for recursive blame
- Filter git-log for directory HOT 2
- Mising `:` after the key of sign-off trailer HOT 1
- Enable reverse comparing between branches
- Quick scroll-to-top/bottom shortcuts in branch-list popup
- Make file preview scrollable
- adding unstaged changes when not in "work tree" yields only ambiguous error
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.