this post was submitted on 25 Oct 2023
291 points (97.7% liked)

Programmer Humor

32426 readers
854 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] NotSteve_@lemmy.ca 15 points 1 year ago (3 children)

How do you accidentally force push lol

[–] wasabi@feddit.de 22 points 1 year ago (2 children)

I assume the accident was not to force push, but to the wrong branch

[–] magic_lobster_party@kbin.social 15 points 1 year ago

I hope they learned the value of protecting your branches.

[–] Redscare867@lemmy.ml 3 points 1 year ago* (last edited 1 year ago) (1 children)

This is why I always git push origin +branch_name

[–] forgeddit@sopuli.xyz 1 points 1 year ago* (last edited 1 year ago)

My go-to these days is to push the current branch, dynamically.
git push origin HEAD

Depending on the VC, HEAD has different prefix/suffixes to make it work.

Edit: formatting, also I never checkout master I do origin/master so I cannot even push it with this method. I think

[–] DacoTaco@lemmy.world 8 points 1 year ago

I was wondering the same. Any branch that has any logic besides a ci build attached to it should have been force push protected by default...

[–] sebsch@discuss.tchncs.de 1 points 1 year ago

Git rebase makes it possible getting used to do so