Support splitting hunks upon staging #385

Closed
vmalloc opened this Issue Mar 6, 2012 · 7 comments

Projects

None yet

5 participants

@vmalloc
vmalloc commented Mar 6, 2012

Hi,

I use the interactive staging commands pretty often. It would be very useful to split hunks (like done with 's' in git-add -p) when choosing what to stage.

Thanks,

Rotem

@snogglethorpe
Contributor

You can kinda do that already, by using the "-" command to make the hunks smaller until they split naturally, and then stage the ones you want.

[I've had some problems in the past where the smaller amount of hunk context (down to zero!) caused the wrong part of the file to be staged, but haven't seen that happen in a long time, so I dunno if it's really a current bug or not....]

@vmalloc
vmalloc commented Mar 7, 2012

I guess this works for me. Thanks!

@rabio
Contributor
rabio commented Mar 7, 2012

If you highlight region in hunk then only that part of it will be staged when you press s instead of whole hunk. Similarly you may highlight part of staged hunk to unstage that part only with u.

The only thing is that a cursor must be inside hunk (important when you want work with something on end of hunk for example).

For me it provides full replacement of git-add -p and is much simpler to interact with.

@snogglethorpe
Contributor

@rabio Whoa, nice! I never knew about that!

@vmalloc
vmalloc commented Mar 8, 2012

Anyways - I'm leaving the feature request open because it would still be nice to split hunks of adjacent lines even further (something like the 'e' flag in git-add -p)

@ernestas

Highlighting the region and staging/unstaging does exactly the same thing as git's e flag does in git-add -p. I think this issue can be closed.

@tarsius
Member
tarsius commented Apr 20, 2013

Closing since there are indeed several convenient ways already to stage "little hunks".

@tarsius tarsius closed this Apr 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment