this post was submitted on 12 Feb 2024
170 points (93.8% liked)

Programmer Humor

31793 readers
69 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
top 21 comments
sorted by: hot top controversial new old
[–] [email protected] 59 points 6 months ago (4 children)

“only one person per file”

so we’ve reverted back to the rcs/cvs days?

[–] [email protected] 11 points 6 months ago

GLADOS was already attempting to digitize employees. And we all know you don't concatenate employees, because the DIFFs become useless.

[–] [email protected] 6 points 6 months ago

welcome to Microsoft SourceSafe :)

[–] PlzGivHugs 2 points 6 months ago

Well, this takes place in the Half Life/Portal universe where the world basically ended in the early 2000s, so it makes sense.

[–] [email protected] 2 points 6 months ago

We don’t even have that rule with CVS. Sometimes you have a merge conflict after cvs up, well then you fix it. That’s how it’s supposed to work.

[–] [email protected] 33 points 6 months ago (1 children)

Taking the time to learn how git works on a conceptual level and then how to resolve merge conflicts effectively is a worthwhile investment. Highly recommended

[–] [email protected] 2 points 6 months ago (1 children)

Even better, learn how to avoid conflicts from happening in the first place!

[–] [email protected] 3 points 6 months ago (2 children)

How do you avoid conflicts happening in the first place?

[–] [email protected] 5 points 6 months ago (1 children)

You don't. One of the core aspects of Git is that it fully expects conflicts to be inevitable, and it gives you tools to resolve them.

I will say that if you learn to aggressively rebase branches, you can at least occasionally reduce the complexity of conflicts.

If you are working on a long branch and three other branches that conflict with your changes land in the meantime, a simple merge will force you to reconcile all of those conflicts in one big stinky merge commit.

If you instead rebase after each individual branch lands, you resolve the same number of conflicts but in three smaller, focused steps instead of one big ugly one. You also don't get a merge commit full of redundant deltas that serve only to resync your branch to master; all the conflict resolution becomes baked in to your individual branch commits.

Spreading out the problem is not reducing the problem. But it can make fixing the problem less daunting, which has a similar effect.

[–] [email protected] 3 points 6 months ago* (last edited 6 months ago)

That was the point of my comment, unless they wrote this ironically.

Sorry you went through the trouble of writing all of this explanation, I hope this is useful to someone else

[–] [email protected] 1 points 6 months ago* (last edited 6 months ago) (1 children)

It's kind of difficult to explain in the same way git is difficult to grok on the first try.

Perhaps it's convincing enough to just say:

  • Git is the fundamentally better at resolving merges/rebases without conflicts than older VCS that don't maintain a commit tree data structure.
  • Even within just git, using one diff algorithm vs another can mean the difference between git successfully merging vs failing and showing you a conflict
  • Software is flexible -- there are endless permutations to how it can be structured. Everything else being equal, some code/commit structures are more prone to conflicts than others

I.e. whether a conflict will happen is not some totally unpredictable random event. It's possible to engineer a project's code & repo so that conflicts are less common.

[–] [email protected] 1 points 6 months ago (1 children)

I can think of some "programming best practices" that can help with reducing merge conflicts, such as making small functions/methods, but I see it as a positive side effect.

I don't think avoiding merge conflicts should be a goal we actively try to reach. Writing readable code organized in atomic commits will already help you get fewer conflicts and will make them easier to resolve.

I've seen too many junior and students being distracted from getting their task done because they spent so much time "coordinating" on order to avoid these "scary" merge conflicts

[–] [email protected] 2 points 6 months ago* (last edited 6 months ago)

avoiding merge conflicts

No, not like that -- you misunderstand. I'm not talking about actively avoiding conflicts. Coordinating to avoid merge conflicts is the same work as resolving a merge conflict anyway, just at a different time.

I'm talking about creating practices and environments where they're less likely to happen in the first place, never incurring the coordination cost at all.

One example at the individual level is similar to what you mentioned, but there's more to it. E.g. atomically renaming and moving in separate commits, so git's engine better understands how the code has changed over time and can better resolve merges without conflict.

But there're other levels to it, too. A higher-order example could be a hot module where conflicts frequently occur. Sure, atomic commits and all that can help "recover" from conflict more easily, but perhaps if the hot module were re-designed so that interface boundaries aligned with the domains of changes that keep conflicting, future changes would simply not conflict anymore.

IMO the latter has an actual productivity benefit for teams/orgs. Some portion of devs just aren't going to be that git proficient, and in this case, good high level organization is saving them from losing hours to incorrect conflict resolutions that can cause lost work, unintended logical conflicts (even though not lexical conflict), etc. Plus, it implies abstraction boundaries better match the changes demanded by the domain, so the code is likely easier to understand, too.

[–] [email protected] 31 points 6 months ago

"Cave Johnson here. We are implementing a new policy, effective immediately. The git blame command will now be used to blame individual programmers. The blamed party will temporarily be reassigned to our home appliances division to test our new line of giant washing machines by riding the spin cycle. Don't worry, it's perfectly safe, but we are not liable for personal injury or death."

[–] [email protected] 16 points 6 months ago* (last edited 6 months ago) (1 children)

Might as well use Google drive... Or maybe actually learn to use git? The learning curve is steep but it's worth investing in it

[–] [email protected] 5 points 6 months ago (1 children)
[–] [email protected] 4 points 6 months ago
[–] [email protected] 11 points 6 months ago (1 children)
alias git pull="git pull --rebase"
[–] [email protected] 26 points 6 months ago
git config --global pull.rebase true
[–] [email protected] 5 points 6 months ago* (last edited 6 months ago)

I just stash everything and manually copy-paste all the relevant changes, I'm salaried so I don't care about wasting time

[–] [email protected] 3 points 6 months ago

I still kind of miss continuous integration.