hzh
hzh

Reputation: 342

Git: Will there be dangling blobs in the remote repo?

If I created some dangling blobs or commits on my local repo(say by amending or rebasing commits), will these dangling objects be pushed to remote repo when I run git push?

Also if I created some dangling blobs in the remote repo (say by rebasing locally and then force update the remote repo), how will git handle the dangling objects in the remote repo? Will they remain there forever?

Upvotes: 2

Views: 257

Answers (2)

VonC
VonC

Reputation: 1326782

Check also the list of commands triggering a gc --auto:

git receive-pack (done on a git push on the remote side) will generate a gc --auto.
So the remote repo will be cleaned eventually if there are regular pushes.

Upvotes: 0

torek
torek

Reputation: 489083

The short answer is that you don't have to worry about this, the same way you don't have to worry about them in your own local repository.

The long answer is complicated: the precise points at which git gc runs and discards dangling objects depends on whether reflogs are enabled and the specific Git version installed, among other things. As a rule, though, git push itself does not push unused objects, so you must generate unreferenced objects on the server via force-push.

Upvotes: 1

Related Questions