this post was submitted on 23 Jul 2024
443 points (96.4% liked)

Programmer Humor

19166 readers
575 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
443
rm -rf / (programming.dev)
submitted 1 month ago* (last edited 1 month ago) by JPDev to c/programmer_humor
 
you are viewing a single comment's thread
view the rest of the comments
[–] nous 9 points 1 month ago (2 children)

I have never had git get into a state I cannot get out of. Even if that is a reset, checkout or clean. And those are very rare. How are people breaking things so often.

Learn the tools you use daily, it saves you a lot of headache in thelong term.

[–] [email protected] 6 points 1 month ago

Oh yeah, but I'm talking about the internal Git state just genuinely being broken, for example: https://stackoverflow.com/questions/14448326/git-commit-stopped-working-error-building-trees
Ultimately, if you spend half an hour debugging that, it just starts being a waste of time compared to cloning anew.

As for how to merge, yes, one should learn that. The problem is that the complexity of the code changes adds on top of whatever insecurities you might still have with Git.
I did put "inexperienced" in braces there, because even as an experienced dev, merges are sometimes just not worth doing. In that case, you could just checkout the branch a second time, but well, still not that different.

[–] [email protected] 1 points 1 month ago (1 children)

Step 1. Forget to push local commits

Step 2. Push commits from another machine

Step 3. Pull from remote om the first machine

I'm a bit of a noob, I often do this when I get too careless.

[–] nous 2 points 1 month ago

That should not break things though. Maybe get a merge conflict that you need to sortout at worst. This is essentially the constant state of working with other people on a project.