this post was submitted on 07 Feb 2025
747 points (99.1% liked)

Programmer Humor

33584 readers
17 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
all 35 comments
sorted by: hot top controversial new old
[–] NegativeLookBehind@lemmy.world 88 points 2 weeks ago (2 children)

If you've ever royally fucked something up in git, that hotline is necessary

[–] synae@lemmy.sdf.org 24 points 2 weeks ago (1 children)
[–] lord_ryvan@ttrpg.network 9 points 2 weeks ago (1 children)

I have been that friend from the alt text at every place I have worked. I shudder to think how they're going about their projects without me, now.

[–] Jesus_666@lemmy.world 2 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

I'm kinda planning on teaching my team how to use interactive rebases to clean the history before a merge request.

The first thing they'll learn is to make a temporary second branch so they can just toss their borked one if they screw up. I'm not going to deal with their git issues for them.

[–] corsicanguppy@lemmy.ca 3 points 2 weeks ago (2 children)

I'm kinda planning on teaching my team

I'm not going to deal with their git issues for them.

These two statements contradict each other.

[–] Jesus_666@lemmy.world 2 points 2 weeks ago

That's why I'll make damn sure they'll make that second branch first.

Mind you, the most likely result is that I'll still see branches with 50+ commits with meaningless names because nobody ever rebases anything.

[–] JustAnotherKay@lemmy.world 2 points 2 weeks ago

I disagree. I don't wanna deal with my coworkers work, so I'm teaching them to deal with it themselves. Not necessarily in the best way for them to do it, but in an easy way to teach and an easy way to get right

[–] expr@programming.dev 20 points 2 weeks ago (1 children)

Never understood why this is such a trope. There's very little you can't recover in git (basically, only changes you never committed in the first place).

[–] AdamEatsAss@lemmy.world 3 points 2 weeks ago (1 children)

Have you ever tried a rebase?

[–] expr@programming.dev 28 points 2 weeks ago

Not sure if serious or not, but yeah I use interactive rebases every day, many times a day (it's nice for keeping a clean, logical history of atomic changes).

It's very simple to recover if you accidentally do something you don't intend (git rebase --abort if the rebase is still active, git reflog to find the commit before the rebase if it's finished).

[–] braindamagebuddy@lemmy.world 47 points 2 weeks ago (3 children)
[–] xavier666@lemm.ee 16 points 2 weeks ago (1 children)

You can prevent suicide by eating a pizza made with glue ✨✨

[–] Kusimulkku@lemm.ee 2 points 2 weeks ago

Prevent or commit?

[–] fmstrat@lemmy.nowsci.com 3 points 2 weeks ago

Probably because of the word conflict being a trigger word.

[–] A_Very_Big_Fan@lemmy.world 3 points 2 weeks ago

It's cropped out u_u

[–] LovableSidekick@lemmy.world 43 points 2 weeks ago (1 children)
IN CASE OF FIRE:

1. git commit
2. git push
3. exit building
[–] hakunawazo@lemmy.world 30 points 2 weeks ago* (last edited 2 weeks ago)
THE CAUSE OF FIRE:  

1. git pull
2. merge conflict
3. starting fire
[–] pfoxx0@lemmy.blahaj.zone 33 points 2 weeks ago* (last edited 2 weeks ago) (2 children)
[–] Gork@lemm.ee 22 points 2 weeks ago

"Fuck the code review!"

[–] hakunawazo@lemmy.world 13 points 2 weeks ago

It moves the suicide to the other end of the repository.

[–] alphapuggle@programming.dev 31 points 2 weeks ago
[–] tyler@programming.dev 21 points 2 weeks ago (1 children)

I actually feel disgusted when I see Google search now. It’s just so bad that even the logo does it.

[–] Reddfugee42@lemmy.world 3 points 2 weeks ago

Aww hang in there little fella

[–] Hupf@feddit.org 15 points 2 weeks ago
[–] _____@lemm.ee 8 points 2 weeks ago (1 children)

I will say. if you have no idea at least clone your branch so you can experiment on it.

[–] pastermil@sh.itjust.works 11 points 2 weeks ago

Experiment on the suicide hotline? I'm sure they won't appreciate that!

[–] umbrella@lemmy.ml 6 points 2 weeks ago

sounds about right

[–] LemoineFairclough@sh.itjust.works 6 points 2 weeks ago (1 children)

Doesn't git status tell you what to do?

use "git add ..." to mark resolution

use "git commit" to conclude merge

I always use git status to check what is appropriate before doing anything else, since the right thing to do can sometimes be different, like after using git rebase when a break command was used vs when a squash command resulted in a conflict.

[–] Oinks@lemmy.blahaj.zone 3 points 2 weeks ago (1 children)

To be fair that's not the entire story, since you need to actually resolve the conflicts first, which is slightly scary since your worktree will be broken while you do it and your Linter will be shouting at you.

You may also want a dedicated merge tool that warns you before accidentally commiting a conflict and creating a broken commit.

Oh and non trivial resolutions may or may not create an evil merge which may or may not be desirable depending on which subset of git automation features you use.

Using git status often is definitely good advice though.

[–] goodthanks@lemmy.world 2 points 2 weeks ago

Magit for Emacs is an excellent tool for resolving conflicts.

[–] NigelFrobisher@aussie.zone 4 points 2 weeks ago

Branching version control was definitely a “they have played us for absolute fools” moment. Especially after all our projects ended up as isolated branches on isolated microservice repositories so basically none of our code was being integrated, let alone continuously. Good for full-remote open source projects where a central admin team has to police submissions though.

[–] PowerCrazy@lemmy.ml 1 points 2 weeks ago

Git is great. Git is Complicated. But assuming you have a protected master branch that requires PRs and will detect merge conflicts before attempting to merge, it's not really dangerous. It is however frustrating.

[–] exu@feditown.com 1 points 2 weeks ago

Praise be Magit, which actually allows me to handle stuff like that moderately confidently.

[–] Lightfire228@pawb.social 0 points 2 weeks ago

I mean, you just need to look at the conflicting files, fix up the code, then stage those changes and pop a new commit

There's no "special" merge conflict resolution commit "type"


As for fixing the code itself, I usually look at what changed between both versions, and then re-author the code such that both changes make "sense"