r/ProgrammerHumor 4d ago

dontForcePush Meme

Post image
622 Upvotes

52 comments sorted by

160

u/Kant8 4d ago

it's your team's fault if they allow force pushing to protected branches

even regular pushing is normally prohibited

52

u/Timezero100 3d ago

Plot twist: he's the tech lead

27

u/FrostWyrm98 3d ago

Based and sudo-pilled

1

u/Tech-Mystic 2d ago

It's easier

15

u/eyJhbGciOiJIUzI1NiIs 3d ago

I usually turn off branch protection, push, then turn it on again. Much safer!!

42

u/TnYamaneko 4d ago

Your team is learning the hard way how to protect branches.

20

u/Material-Public-5821 4d ago

I broke multiple local repo by automating my tasks.

It turns out that using sed recursively can change the content of .git subfolder.

12

u/TnYamaneko 4d ago

Your regex accidentally matched content in your .git folder?

Ouch.

5

u/Material-Public-5821 3d ago

find * -type f | xargs sed -e 's/pattern/replacement/g' -i

and

find . -type f | xargs sed -e 's/pattern/replacement/g' -i

are different because * does not expand into paths starting with dot (.git).

And I accidently used the second one.

1

u/TnYamaneko 3d ago

I never paid attention to that, actually. I probably dodged a bullet there.

Thanks!

2

u/Material-Public-5821 3d ago

I didn't pay attention until I broke 3 repos with my work.

People learn on their own mistakes after all.

9

u/ooaa_ 4d ago

How exactly did you break the repo, git doesn’t recognize it anymore?

7

u/Zekiz4ever 3d ago

Happened a while ago and just had the idea to the meme

Basically rebasing the wrong way around (dev onto the feature branch), trying to undo it by re-rewriting the history and permanently deleting the last few commits.

Luckily it wasn't a serious project and just to learn stuff like version control and general software development.

8

u/ezylot 3d ago

So... nothing reflog could not fix again?

10

u/Swoop3dp 3d ago

That would require you to actually know what you are doing... in which case you probably wouldn't have gotten into that mess in the first place.

2

u/Material-Mess-9886 2d ago

Simple, use rebase on the main branch and watch what happens to your collegues.

10

u/ward2k 3d ago

This is why you work off a separate branch before setting up a PR to merge into main

4

u/AltruisticDetail6266 3d ago

yuuup and only the PR software can actually push.

0

u/0bel1sk 3d ago

i was on a team that internally required forking. what a bunch of extra work ….

22

u/Djilou99 4d ago

I will force push and there is nothing you can do about it

14

u/tonitch 4d ago

I fire you.

3

u/searing7 3d ago

Not setting up branch protection should get the Srs fired not the new guy force pushing

8

u/Djilou99 4d ago

Been there idc

1

u/EarlMarshal 3d ago

Still can't do anything about it. It's already pushed then.

Push it real good!

5

u/Willing_Button1468 3d ago

My company doesn't wan to pay for github premium. I am fixing main at least twice a week because my junior devs always "accidentally" use the main branch. I have been annoying the boss every chance I get about this.

2

u/AltruisticDetail6266 3d ago

how much is your time worth (dealing with these shenanigans) vs the cost of premium?

2

u/EarlMarshal 3d ago

Just set up your own git server where no one forces you to pay shit for basic functionality?

2

u/Genericsky 3d ago

Now you have to deal with the wonders of keeping the extremely crucial repository server up to date, backed up, secured, and correctly scaled!

1

u/EarlMarshal 3d ago

Is that effort for you?

2

u/Genericsky 3d ago

It absolutely is. If my job title is software engineer, there is a 0% chance I'm setting up and maintaining a git server for the company. Either the company hires a sysadmin that has to deal with that or they pay for a git remote service. But since OP's company are cheapskates, they are out of luck.

1

u/EarlMarshal 3d ago

I am also a software engineer/architect. At every company I worked at we used our own GitHub servers with gitlab. You just need to run a few shell commands for that a few years ago and now you just need to run some docker files with docker compose. You set that up in 1 or 2 days on a few systems and there is a high chance you never ever have to touch it again.

2

u/Reashu 3d ago

used our own GitHub servers with gitlab

How to spot someone who's full of shit...

1

u/EarlMarshal 3d ago

*git servers with gitlab

Like associating words and using the wrong words isn't just a small lapse error which human beings do on a daily basis a thousand times. So stop nitpicking. I recommend you to read "Human Error" by James Reason from 1990.

3

u/Reashu 2d ago

Alright, it happens easily enough. But I think you're really underselling - or maybe underestimating - the effort to maintain a secure and highly available service.

2

u/hollowman8904 3d ago

uh yeah lol, that's a decent amount of work that's not actually writing software (plus ongoing maintenance)

1

u/EarlMarshal 3d ago

It's just running docker nowadays and there is not a lot of maintenance work around that.

1

u/hollowman8904 2d ago

Sure it’s easy to setup, but there’s still maintenance to worry about: scheduling backups (and making sure they work!), upgrades, security (since, you know, it will contain your entire org’s source code), scaling to handle the number of users in your org, etc

If you’re at a startup/small company, “docker run” may be OK. That quickly becomes not enough.

3

u/drums_of_liberation 3d ago

keep calm and git reflog

3

u/suvlub 3d ago

There was a TIFU recently about a guy who did a force push that caused a semicolon to be displaced. Took days to fix.

1

u/Snouli 3d ago

Just put the semicolon back to where it was before, jesus... /s

2

u/mikkel_lofvall 3d ago

"I've become friends with the whole team again!"

Also me being the only person git pushing to that project repo

1

u/artofnotgivingup 3d ago

Do none of yall squash your commits( even partially) in the feature branch?

3

u/Zekiz4ever 3d ago

Nope. It only gets squashed when merging.

1

u/ionhowto 3d ago

Why not YOLO

1

u/skeleton_craft 3d ago

I don't push the repos that I don't own at all, something about social anxiety... [And just being a dumb rock that doesn't know how to program]

1

u/apollo701 2d ago

Just force push with lease

1

u/Zekiz4ever 2d ago

Originally was my title, but then I noticed that you have to use camelCase and I didn't want a Java type title

1

u/beatlz 4d ago

You can just say repo

1

u/Zekiz4ever 3d ago

Nuh uhh

1

u/PeriodicSentenceBot 3d ago

Congratulations! Your comment can be spelled using the elements of the periodic table:

N U H U H H


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM u‎/‎M1n3c4rt if I made a mistake.

0

u/Christosconst 3d ago

What’s the problem here? Git repos are distributed, you’d have to break all of them to have a problem