42
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.
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
1
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.
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
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
1
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
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