Click on origin after reflog and gc prune expired

I removed some unreachable and dangling commits in my local repo using

git fsck --unreachable --dangling --no-reflogs
git reflog expire --expire=now --all
git gc --prune=now

      

But I found that the deleted commits are still available at the start (GitHub, to be precise).

I tried it git push --force

, but it doesn't sync the changes at the start. How can I force the changes to sync back to the source (are the unreachable / dangling commits removed from the remote)?

This is a similar unanswered question:

Gc prune scope and git reflog expire and related config

+3


source to share


1 answer


Short form

You cannot dictate how the remote keeps its data from the client.

Longer form

First, I think the place to start is to understand that your local repository is not the same as the remote one. git fsck

and git gc

are running in a local repository that you already knew about since you are asking the question.



Second, Git works by transferring objects. The trick here is that we are talking only about reachable objects over the wire. Meaning, there must be a path from a link (branch or tag) to an object in history somehow. If the referencing object is not available, Git will refuse to transfer it to the client, even if it is in the object's database. The downside to this is that anything you do locally that does not involve changing or updating a link cannot be transferred between local and remote repos. You cannot say "sync my layout of the local database object with the remote". You can only say, "Make the objects accessible between my local and remote the same."

Finally, how things will be presented on GitHub, and whether objects will end up being clipped, is entirely up to GitHub. Zach Holman talked about some of the things going on behind the scenes. My guess is that they run something in the background to trim the dangling objects at some point, but from a remote access point of view, this really doesn't matter - people can't access unreferenced objects. It remains only to leave the size. I know they are doing some kind of pruning because I have trimmed the repos in the past and reduced their size (you can check this by looking at the size element using the api call. You can try this as an example: https: // api .github.com / repos / jszakmeister / vimfiles ).

If your goal is to reduce the size of the repository because you checked out objects that are too large, see the Removing Sensitive Data page from the GitHub Help topic. It applies equally to large files that you want to permanently delete (just deleting them with a commit doesn't remove them completely from history).

If the goal is to reduce the size of the repository by compacting and removing dangling objects, GitHub is already doing something out there and you don't really have much control over how it's done. They take a very long time to keep it small, fast and efficient though.

+3


source







All Articles