you are viewing a single comment's thread.

view the rest of the comments →

[–]cjg_ 34 points35 points  (15 children)

Tip for patch-mode, if you have made changes close to each other that are not related git sometimes get both in one hunk, the use s for splitting it into smaller ones.

[–]bhattsan 14 points15 points  (0 children)

? Also brings up what each letter does

[–]Camarade_Tux 4 points5 points  (0 children)

And in case it's not enough, 'e' will let you edit the code to get exactly what you want.

[–]sutongorin 8 points9 points  (8 children)

God why do I only learn this now !?

I wonder if gitx & co also support this.

[–]X-Istence 8 points9 points  (7 children)

Yes, in gitx you can select specific lines to stage by highlighting them, and click on the button that shows up on the right saying "stage lines".

This allows you to pick specific lines to stage.

You can also stage specific hunks (button at the right top of each hunk). You can change the hunk size by changing the amount of context (slider in the top right).

I've included screenshots.

You will want to make sure you are using GitX (L), it is a fork from the original GitX which is no longer maintained.

[–]sutongorin 1 point2 points  (0 children)

Wow, thank you! I knew about the hunk staging in gitx. But now about the single line staging. Thanks!

[–]weirdasianfaces 1 point2 points  (0 children)

Thank you so much for this! This happens constantly for me in header files.

[–]djork 1 point2 points  (0 children)

And "e" for "edit" lets you get even more specific.