I know this is a joke, but those errors/warnings/messages screenshot is not from git. That looks more like results from a compiler of some sort.
Looks exactly like Visual Studio 2022.
I guess the joke implies that automated (or incorrect manual) conflict resolution causes code that doesn’t compile. But still not git’s fault. They should probably have merged earlier and in rare cases where that wasn’t possible, you have to bite the bullet and fix this stuff.
When people do a bunch of bulk renames on every commit, then you get this kind of problem a lot. But yeah still not gits fault
In my experience, this amount of conflicts typically occurs because 1) most people mass commit a bunch of (mostly unrelated) changes at once, which leads to 2) inexperienced/impatient devs to clobber incoming merge conflicts without doing proper merges (mostly because they can’t make heads or tails of the diffs).
This is very easily mitigated if all developers would make small, related commits (with descriptive commit messages and not “committing changes”). This makes everybody’s life easier because 1) diffs are smaller and readable for conflicts, 2) the dev can see the progression of code through commit history, 3) broken code is more easily revertable (and traceable) if something goes wrong, and 4) it’s easier to cherry pick specific changes if the whole changes cannot be published all at once.
Also,
git pull --rebase
is your friend and not scary at all. It applies all incoming changes first, then applies your new commits last. 9 out of 10 times it avoids conflicts.Lastly, use a GUI. There are plenty out there to suit your tastes, and I feel they are a safer and easier alternative than CLI. Some GUIs are very safe and even allow undo operations on most things.
not scary at all
I have seen some juniors really shoot themselves in the foot with rebasing, and I’ve been there as well before. I agree it can be useful, but it definitely requires understanding of what is going on :P
What I suggest is not the same as using
git rebase
. It’s pretty automatic and easily abortable.
Sometimes I look at the memes around here and wonder wtf y’all are doing. Like, neither my code nor the code at the place I work at are perfect. But I don’t think I’ve ever seen a merge do this. Maybe some of the most diverged merges temporarily had a lot of errors because of some refactoring, but then it was just a few find + replaces away from being fixed again. But those were merges where multiple teams had been working on both the original and the fork for years and even then it was usually pretty okay.
CS students
This is true. I got really good at fixing merge conflicts in college
You kinda have to when half of your “team” is barely even able to write code.
It’s really easy to make a gigantic mess using git if you don’t know what you’re doing. As soon as you learn to keep your history mostly linear all those issues go away.
To be fair, this is also how VS looks when you open a project fresh from the clone. Or after updating .net versions. .NET is awful about losing references and then claiming thousands of errors. Sometimes just running the build will fix it by relinking the DLLs it couldn’t find.
But also yes, VS with a team can be “fun” if people don’t sync their formatting settings. I once had a junior that kept converting spaces to tabs on every file he’d touch. You’d get it fixed and then he’d screw up his settings again with a VS update or something.
Try programming in Dart. Dart’s static analyser and package manager will go nuts 0.0001 seconds before the fucking packages load
he was doing gods work
No
Tabs > spaces
Tabs does allow you to set the spacing you need.
Spaces are like hardcoding passwordsYeah, tabs are larger spaces, what’s your point?
/s
You may be right, but I still have an unreasonable hate for tabs in code
And I for spaces.
Let’s hate both and be mad at the client?
I like the way you think.
Tabs for indenting and spaces for aligning. There. Everybody wins and loses.
This way the code always looks aligned and if you prefer 4 spaces for a tab instead of 2 or 3 or 8 you can just set it in your IDE.
Crisis averted!
Both tabs and spaces are stupid.
It’s ridiculous that in 2024, code formatting is still embedded in the source instead of being a style you apply.
POV: Your codebase undergoes a full refactor for every feature
My codebase doesn’t have features, I’ve been refactoring hello world for 25 years.
ALL KINDS OF SUFFERING ARE MERGE CONFLICTS
GIT IS OUR MIRROR
REBASE IS HEAVEN
oof.wav
I suck at git.
I’m currently rebasing 17k commits into my branch. I’m letting it run overnight.I’m disgusting.
Removed by mod
Jokes on merge… when a rebase editing goes wrong after +15 commits and six hours, and git hits you with a leadpipe: “do it. Do it again, or reassemble your branch from the reflog.” I.e. you commited a change very early, went over bunch of commits resolving/fixing/improving them and at middle way forget if you should
commit --amend
orrebase --continue
to move forward. Choose wrong, and two large change-sets get irreversilbly squashed together (that absolutely shouldn’t), with no way to undo. Cheers. 👍Narrator: But it could, in fact, hurt him…
I literally make a new branch. clone, and use an external merge tool (beyond compare) when my branch has fallen too far behind. I don’t trust any of the automated processes.
rerere makes resolving these almost bearable
Git flow eliminated 95% of merging issues for my team