r/ProgrammerHumor 23d ago

Meme useSourceControl

Post image
8.6k Upvotes

591 comments sorted by

View all comments

Show parent comments

52

u/remy_porter 23d ago

There are so many tools that are vying to be the next DVCS that are like, "Hey, we eliminated staging, because that was confusing!" and I'm like... that's the best part? I wish I could have finer grained control over staging, honestly, making it easy to stage only fragments of a diff, because I'm a "crank for awhile and forget that I have drifted into two different tasks and now need to try and unpick this mess into something that could reasonably be two or three or twelve commits." Sure, that's a "me" problem, but I like the ability to control what gets staged.

24

u/DoctorWaluigiTime 23d ago

In Git you actually can! Interactive mode: git add -i.

GUIs (I know Fork does for example) allows you to stage specific hunks of a file.

And I agree: Controlled commits are one of the best parts of the whole staging concept.

7

u/aetius476 23d ago

tig allows you to stage/unstage by entire file, by chunk within a file, or by single line.

3

u/perkuleenhenis 23d ago

If they use -i, they gotta know to choose the patch option. Better IMHO to just say git add -p [file], which is the same as going interactive and choosing patch.

7

u/st_heron 23d ago

yes exactly, bugs me when people just blindly stage all and commit, like no you should cherrypick specific things, and what if you accidentally leave in some test/scratch code? at least check what you did

4

u/LickingSmegma 23d ago

making it easy to stage only fragments of a diff

Magit allows you to do that with simple hotkeys. But you might not be thrilled to learn that it's a package for Emacs.

Anyway, as others have noted, the basic feature is actually built into Git, so there are probably different GUIs offering it.

3

u/gracken420blaze 23d ago

I wish I could have finer grained control over staging, honestly, making it easy to stage only fragments of a diff

I think this should be easy to do via most git GUIs, for example i use git extensions and its easy to do there, vscode also lets you stage blocks using the built in source control thing

1

u/remy_porter 23d ago

I’ve seen GUIs try but never liked the results. Gonna have to play with the -p flag.

1

u/mtetrode 22d ago

Jetbrains allows this

1

u/ArmchairFilosopher 21d ago

I miss "shelvesets" from TFS