5

Use case: I want to mirror a bunch of repositories of a project. I suppose this would be pretty easy with a script.

But to the git part: I fear that the developers might force push things and thus revert commits and de facto delete code.

Is there a way to git clone and auto-checking out to a different branch or something else, to avoid force pulling and reverting commits?

you are viewing a single comment's thread
view the rest of the comments
[-] just_another_person@lemmy.world 7 points 5 days ago

Mirroring is exactly that: a copy

If the thing you are mirroring does something you don't like, you can't stop. Literally imagine standing in front of a mirror and trying to stop the reflection from doing something you don't like. Not happening.

The thing about git is that it keeps all history, even in a force push situation, unless they actively clear previous history, which is... difficult.

What you can do is lag proxy whatever the main branch is to catch it in time, or just keep revisions of your mirror that you script and tag yourself. It's like a daily backup you can go back and look into.

It's going to waste a ton of space and time, but it would effectively create a stop-loss on someone nuking history, which generally is just not a thing that people do because it's entirely stupid.

[-] dgdft@lemmy.world 2 points 5 days ago

Great answer on the whole, but worth noting that both Git’s standard CLI client and most hosted git services do run periodic GC to prune dangling commits.

I second the suggestion to take periodic snapshots of your mirror. Because the majority of file contents will not be changing over time, you can make these snapshots very disk-space efficient by taking binary diffs of the tar’d repo using rdiff or the like.

[-] pantherina@feddit.org 3 points 5 days ago

True, I can do that with btrfs snapshots

load more comments (2 replies)
load more comments (2 replies)
this post was submitted on 10 Dec 2025
5 points (85.7% liked)

Linux

10608 readers
413 users here now

A community for everything relating to the GNU/Linux operating system (except the memes!)

Also, check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 2 years ago
MODERATORS