this post was submitted on 03 Mar 2024
1 points (100.0% liked)

Programmer Humor

19149 readers
1201 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
 
top 33 comments
sorted by: hot top controversial new old
[–] Ohi@lemmy.world 1 points 6 months ago

Aye, most of my 10 year career in web dev is pretty much those commands. However, some advanced git concepts are worth diving into. Stuff like git bisect that can narrow down the exact commit that broke your app is an absolute life saver. Knowing how to git cherry-pick is also a git skill professionals should be comfortable doing. Migrating work from one branch to another without merging the entire branch is pretty common.

[–] punkwalrus@lemmy.world 1 points 6 months ago (2 children)

The thing is that for a majority of cases, this is all one needs to know about git for their job. Knowing git add, git -m commit "Change text", git push, git branch, git checkout , is most of what a lone programmer does on their code.

Where it gets complicated real fast is collaboration on the same branch. Merge conflicts, outdated pulls, "clever shortcuts," hacks done by programmers who "kindof" know git at an advanced level, those who don't understand "least surprise," and those who cut and paste fixes from Stackexchange or ChatGPT. Plus who has admin access to "undo your changes" so all that work you did and pushed is erased and there's no record of it anymore. And egos of programmers who refuse any changes you make for weird esoteric reasons. I had a programmer lead who rejected any and all code with comments "because I like clean code. If it's not in the git log, it's not a comment." And his git comments were frustratingly vague and brief. "Fixed issue with ssl python libs," or "Minor bugfixes."

[–] bleistift2@feddit.de 0 points 6 months ago

If it’s not in the git log, it’s not a comment.”

This is so incredibly dumb, though I’m sure I don’t have to tell you this. That comment will be buried in the git log if anyone ever fixes a typo on that line.

[–] Ottomateeverything@lemmy.world 0 points 6 months ago (1 children)

I had a programmer lead who rejected any and all code with comments "because I like clean code. If it's not in the git log, it's not a comment."

Pretty sure I would quit on the spot. Clearly doesn't understand "clean" code, nor how people are going to interface with code, or git for that matter. Even if you write a book for each commit, that would be so hard to track down relevant info.

[–] mkwt@lemmy.world 0 points 6 months ago (1 children)

Yeah, I think that guy only got a superficial understanding of what Uncle Bob was saying.

My policy as a tech lead is this: In an ideal world, you don't need the comment because the names and the flow are good. But when you do need the comments, you usually really need those comments. Anything that's surprising, unusual, or possibly difficult to understand gets comments. Because sometimes the world is not ideal, and we don't have the time or energy to fully express our ideas clearly in code.

My policy on SCM logs is that they should be geared more towards why this commit is going in, not what is being done. And what other tickets, stories, bugs it relates to.

[–] bleistift2@feddit.de 0 points 6 months ago

But when you do need the comments, you usually really need those comments.

It’s nice to see you sharing my experience. My code is either uncommented or very severely commented with comment-to-code ratios of 10:1 or more. I hate the files that are soo green… :(

I once had HR ask if I was familiar with G-I-T ( she spelled it out), for a moment, my only thought was "wtf is G-I-T".

[–] redcalcium@lemmy.institute 0 points 6 months ago* (last edited 6 months ago) (2 children)

Interviewer: It's git push origin main now. Get out of here!

[–] cyborganism@lemmy.ca 0 points 6 months ago (1 children)

Just set your default behavior.

[–] OpenStars@startrek.website 0 points 6 months ago (1 children)

I have only ever used simply "git push". I feel like this is a "how to say that you barely know how to use git without saying that you barely know how to use git" moment:-D.

[–] sag@lemm.ee 0 points 6 months ago (1 children)
[–] Cqrd@lemmy.dbzer0.com 0 points 6 months ago* (last edited 6 months ago) (1 children)

You can default git to using your current branch and a specific upstream so you don't have to put anything after git push

[–] sag@lemm.ee 0 points 6 months ago (1 children)
[–] bleistift2@feddit.de 0 points 6 months ago

Has git never told you that you should use git push -u origin <branch> when you push a new branch for the first time?

[–] RustyNova@lemmy.world 0 points 6 months ago (1 children)

Fuck those that use main. If you're working on a library fork that has main and a project that has master you're bound to invert the two.

"What do you mean I can't checkout main? Oh right, here it's master..."

For once that we had a standard, it had to be ruined.

[–] huginn@feddit.it 0 points 6 months ago (1 children)

Fuck those that use master. If you're working on a library fork that has main and a project that has master you're bound to invert the two.

"What do you mean I can't checkout main? Oh right, here it's master..."

For once that we had a standard, it had to be ruined.

The standard is now main.

[–] maynarkh@feddit.nl 1 points 6 months ago (1 children)

The standard is now main.

Git itself does not use that standard yet, so at least now there are two competing standards.

I get that there are cultural reasons why the word master was loaded language, but still, it's not like institutional racism will go away. Meanwhile, the rest of the world which doesn't struggle with the remnants of slavery has to put up with US weirdness.

[–] zalgotext@sh.itjust.works 0 points 6 months ago (1 children)

Git itself does not use that standard yet, so at least now there are two competing standards.

Just ran git init in a brand new empty directory, and while it did create a master branch by default, it also printed out a very descriptive message explaining how you can change that branch name, how you can configure git to use something else by default, and other standards that are commonly used.

Also, there's nothing saying your local branch name has to match the upstream. That's the beauty of git - you have the freedom to set it up pretty much however you want locally.

[–] maynarkh@feddit.nl 1 points 6 months ago

Yeah, that's what I'm saying, there is no one standard now. The stupid thing is all the problems that causes is mostly because there used to be one, and stuff written assuming master branches are eternal.

I've had a company that had some automation built on git but below GitLab that would not let you delete master branches. When main became a thing, they just started hard protecting those as well by name. It's because of regulatory, and they are very stingy about it.

So when I created a few dozen empty deployment repos with main as the default, and then had to change it over to master so that it lined up nicer with the rest of the stuff, I've had a few dozen orphaned undeletable empty main branches laying around. A bit frustrating.

That said, the whole thing is just that. A bit frustrating. If it makes some people feel better about themselves, so be it. I am blessed in life enough to take "a bit frustrating".

[–] SomeBoyo@feddit.de 0 points 6 months ago

git blame is another good one

[–] cows_are_underrated@feddit.de 0 points 6 months ago
[–] gazter@aussie.zone 0 points 6 months ago (1 children)

As someone who knows that they know very little about git, this thread makes me think I'm not alone.

[–] laurelraven@lemmy.blahaj.zone 0 points 6 months ago (1 children)

I think advanced git knowledge, like RegEx, is the exception, while the norm is to know the tiny handful of day to day useful bits

[–] lhamil64@programming.dev 0 points 6 months ago (1 children)

How is regex git knowledge? I guess you can use regular expressions with git grep but it's certainly not a git-oriented concept...

[–] laurelraven@lemmy.blahaj.zone 0 points 6 months ago (1 children)

I don't even know how to respond to this considering it has nothing to do with what I said...

[–] survivalmachine@beehaw.org 0 points 6 months ago (1 children)

There are at least two ways to parse your statement, and they interpreted it differently from your intention.

[–] laurelraven@lemmy.blahaj.zone 0 points 6 months ago (1 children)

I guess, if you ignore the comma...

[–] lhamil64@programming.dev 0 points 6 months ago (1 children)

Rereading it, I now understand what you meant. I interpreted the "like regex" as an example of advanced git knowledge. I'm not sure the comma helps make it unambiguous though.

[–] laurelraven@lemmy.blahaj.zone 1 points 6 months ago

Yeah, reading it again and I can see that interpretation...

This is why you shouldn't rely on yourself alone for proofreading your writing, I probably could have read that a hundred times and not seen another way to read it without someone else pointing it out

[–] Paulemeister@feddit.de 0 points 6 months ago

git commit -am

[–] ramjambamalam@lemmy.ca 0 points 6 months ago (1 children)
[–] aeharding@lemmy.world 0 points 6 months ago* (last edited 6 months ago) (1 children)

git: 'gud' is not a git command. See 'git --help'.

rekt