Giter Site home page Giter Site logo

Per line staging about gitui HOT 30 CLOSED

extrawurst avatar extrawurst commented on May 1, 2024 25
Per line staging

from gitui.

Comments (30)

MuAlphaOmegaEpsilon avatar MuAlphaOmegaEpsilon commented on May 1, 2024 8

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.

extrawurst avatar extrawurst commented on May 1, 2024 8

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:
Screenflick Movie 104

from gitui.

extrawurst avatar extrawurst commented on May 1, 2024 5

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.

hasufell avatar hasufell commented on May 1, 2024 4

Here is some activity.

from gitui.

jason0x43 avatar jason0x43 commented on May 1, 2024 3

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.

stale avatar stale commented on May 1, 2024 3

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.

extrawurst avatar extrawurst commented on May 1, 2024 3

I consider this done now, the remaining two tasks (which I consider less important) will be tackled in a followup later: #582

from gitui.

alex-popov-tech avatar alex-popov-tech commented on May 1, 2024 2

super excited for this feature, that's probably the only thing which stopps me to switch to gitui from vim-fugitive :)

from gitui.

extrawurst avatar extrawurst commented on May 1, 2024 2

ok some progress: support for staging/unstaging changes in a tracked file:

Screenflick Movie 105

see #575

from gitui.

extrawurst avatar extrawurst commented on May 1, 2024 2

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.

tuxlifan avatar tuxlifan commented on May 1, 2024 1

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.

extrawurst avatar extrawurst commented on May 1, 2024 1

staging/unstaging in tracked files is merged. please give it a spin💪

Screenflick Movie 108

from gitui.

disrupted avatar disrupted commented on May 1, 2024 1

@extrawurst great addition! will you publish a new release with this feature?

from gitui.

nbigaouette avatar nbigaouette commented on May 1, 2024 1

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.

nbigaouette avatar nbigaouette commented on May 1, 2024 1

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.

dufferzafar avatar dufferzafar commented on May 1, 2024

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.

gilescope avatar gilescope commented on May 1, 2024

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.

nbigaouette avatar nbigaouette commented on May 1, 2024

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.

nyanpasu64 avatar nyanpasu64 commented on May 1, 2024

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.

hasufell avatar hasufell commented on May 1, 2024

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.

teras avatar teras commented on May 1, 2024

I'd vote also for Space instead of "1", since "1" is already a keystroke to change "window".

from gitui.

ser-drephs avatar ser-drephs commented on May 1, 2024

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.

extrawurst avatar extrawurst commented on May 1, 2024

@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.

non-descriptive avatar non-descriptive commented on May 1, 2024

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.

extrawurst avatar extrawurst commented on May 1, 2024

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 avatar extrawurst commented on May 1, 2024

@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.

extrawurst avatar extrawurst commented on May 1, 2024

@nbigaouette i just merged this into master - would love to get your feedback on this! see #583

from gitui.

nbigaouette avatar nbigaouette commented on May 1, 2024

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.

extrawurst avatar extrawurst commented on May 1, 2024

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.

nbigaouette avatar nbigaouette commented on May 1, 2024

True! Was only whitespaces.

Thanks!

from gitui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.