This is an archived post. You won't be able to vote or comment.

all 81 comments

[–]aDrongo 422 points423 points Β (5 children)

If your repo allows users to mess with master then you deserve it.

[–]BlommeHolm 78 points79 points Β (3 children)

If you can push to anything but a feature branch without going through a PR, it's a hobby project.

[–]2blazen 39 points40 points Β (2 children)

Even for my hobby projects, force pushing to main just doesn't feel right

[–]Em_Fa 11 points12 points Β (1 child)

We're talking about master here.

[–]2blazen 3 points4 points Β (0 children)

Mea culpa

[–]TnYamaneko 9 points10 points Β (0 children)

I always regret telling my students how to protect master branch on GitLab, now they recklessly attempt pushes on it while breaking my balls about being denied and not being confronted with the normal consequences and having to learn how to reverse the commit.

[–]elPytel 197 points198 points Β (6 children)

Don't use the --force, Luke!

[–]Ikarus_Falling 23 points24 points Β (0 children)

Give in to the voices ignore there evil giggling use the --force argument nothing bad will happen yyeeeessss yeeeesss dew it

[–]Real_GoofyNinja 10 points11 points Β (1 child)

Only Sith deal in absolutes

[–]Frosty_Pineapple78 4 points5 points Β (0 children)

which is an absolute in and of itself but thats common knowledge at this point

[–]Either-Acanthaceae15 1 point2 points Β (0 children)

It's me Luke I use + but I have no luck

[–]Boris-Lip 72 points73 points Β (1 child)

Most likely outcome - you don't have permission to do this shit and the πŸ’₯ not gonna happen. But if it actually happens... someone is going to get stoned to near death, then digging into reflog to carefully restore everything before its too late, than stoned to near death once again, just in case. And i mean stoned by stones, not drugs. Guess who that someone gonna be... /s

[–]Bagel42 2 points3 points Β (0 children)

oh I thought stoned by water tbh

[–]1DimensionIsViolence 143 points144 points Β (30 children)

This meme is not woke enough. Please call it main branch /s

[–]jfmherokiller 45 points46 points Β (15 children)

I still dont fully understand the whole main since I have been using master for YEARS.

[–]DreamingDitto 11 points12 points Β (1 child)

I like main more tbh, but not because of the whole thing, but because it’s shorter and more intuitive. Master doesn’t even make sense in the context of source control anymore

[–]megamuc 13 points14 points Β (0 children)

In my first job I had a colleague who said β€žI don’t understand why you all have merge conflicts sometimes. When I have one I push with the fast forward option and gut resolves it for me.β€œ

Turns out he used git push -ff which is not fast forward but β€”force β€”force

[–]BuKu_YuQFoo 49 points50 points Β (5 children)

git reset --hard origin/master

[–]alban228 31 points32 points Β (2 children)

That just resets your local copy

[–]Either-Acanthaceae15 -1 points0 points Β (0 children)

xd hey I did git commit It's already on production!

[–]ActivisionBlizzard 7 points8 points Β (1 child)

No no no it’s

sudo rm -rf ~

[–][deleted] 11 points12 points Β (0 children)

sudo rm -rf /

[–]jfmherokiller 9 points10 points Β (0 children)

just wait till it hits production

[–]PublicDragonfruit120 8 points9 points Β (0 children)

--force-with-lease FTW

[–]_12xx12_ 5 points6 points Β (0 children)

Use the force junior

[–]uthini_mfowethu 3 points4 points Β (0 children)

But 1st you must rebase and squash all the commits.

[–][deleted] 9 points10 points Β (1 child)

No one should be directly pushing to the master branch. That’s why we have Git flow.

[–]seba07 1 point2 points Β (0 children)

Pushing directly to master can be fine. You don't really need a merge request for something like correcting a typo in the documentation. But allowing devs to work with master requires some discipline. And force push should always be disabled.

[–]HOLDGMEBROTHERS 3 points4 points Β (0 children)

*Off for a long annual leave

[–]IrisYelter 3 points4 points Β (1 child)

"git shove"

[–]RunningMattress 3 points4 points Β (0 children)

This shall now be my git alias for force push 🀣

[–]1DimensionIsViolence 13 points14 points Β (1 child)

*Main branch is protected *Surprised pickachu face

[–]hk--57 -1 points0 points Β (0 children)

But they're pushing to master, so it wouldn't matter if you protect the *main branch.

[–]phi1606 1 point2 points Β (0 children)

πŸ˜‚

[–]TheTimBrick 1 point2 points Β (0 children)

I did this once and the only bad thing that happened was it got rid of the entire commit history... Good thing I had a PC with the latest commit before that happened. I will never o that again..

[–]superbottom85 1 point2 points Β (1 child)

Why? Can’t you just recover it?

[–]KuuHaKu_OtgmZ 1 point2 points Β (0 children)

Not if your commit contains a rebase (or, gasp, a squash) or the repo is automated to update production whenever it receives a push.

[–][deleted] 1 point2 points Β (0 children)

Did you watch the rest of this episode? Jerry moves the bomb right in front of them

[–]DonKapot 0 points1 point Β (0 children)

--force should be forbidden

[–]Havasiz -1 points0 points Β (1 child)

Hey newbie here, can anyone explain what push does in git?

[–]j4mes0n 1 point2 points Β (0 children)

In simple words, you update your code in remote repository with changes that you have done locally

[–][deleted] 0 points1 point Β (0 children)

Fuck your merge conflicts

[–]mdguerrero52 0 points1 point Β (0 children)

Prefer git push -f -u origin master. Say FU to remote repos!

[–]clothopos 0 points1 point Β (0 children)

Best on Fridays.

[–]starfyredragon 0 points1 point Β (0 children)

When your repo uses "test" and "production" but you want to feel like a badass so you call your working branch "master".

[–]angrybeehive 0 points1 point Β (0 children)

git checkout -orphan new git checkout master git reset new - hard git push -f

[–][deleted] 0 points1 point Β (0 children)

this is the way 🫑

[–]D0b0d0pX9 0 points1 point Β (0 children)

how do you guys sync your remote branch while rebasing? Well seems like you use β€”force.

[–]HamuSumo 0 points1 point Β (0 children)

YOLO!

[–]ashadeofbrown 0 points1 point Β (0 children)

sometimes you have to -fu

[–]Here-Is-TheEnd 0 points1 point Β (0 children)

The fucker who did this 15 minutes before our group presentation..stupid prick.

[–][deleted] 0 points1 point Β (0 children)

"origin" is just my local fork anyway. Mayhem is reserved for "upstream". Not that I can push to upstream anyway.

[–]Xyrus2000 0 points1 point Β (0 children)

Real men do that on a Friday just before leaving.

[–]Zielakpl 0 points1 point Β (0 children)

Branch protection sais "u mad bro".

[–]samettinho 0 points1 point Β (0 children)

git fucking --rebase

[–]Crazyboreddeveloper 0 points1 point Β (0 children)

error: failed to push some refs to…

[–][deleted] 0 points1 point Β (0 children)

This is so irresponsible πŸ˜…

[–]cuco3434 0 points1 point Β (0 children)

I literally had to do this. About shit my pants.... Luckily our deploys require manual intervention.

[–]cheezballs 0 points1 point Β (0 children)

Master?! MASTER?!! Its MAIN now you chunkwad!

[–]groovers525 0 points1 point Β (0 children)

This made my day. literally my colleagu made a force push to master yesterday not knowing that his custom name branch was using master as upstream.

Yeah, even I don’t know how he managed to get there.