Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6194739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:20:51+00:00 2026-05-24T03:20:51+00:00

I wasn’t sure how to word the question, so apologies if it’s not clear.

  • 0

I wasn’t sure how to word the question, so apologies if it’s not clear. If you git clone a repo that had a bunch of dangling objects, do you clone those? Same for the opposite. If you did a git gc and pushed that to someone else, does their repo lose anything the git gc would have cleaned up?

I would guess that neither of these would occur, but I can’t find any documentation on this scenario.

I found some information that seems to imply that with most protocols git clone gives you a clean repo, but if you specify the file using a file path it copies everything.

The main reason to specify the file:// prefix is if you want a clean copy of the
repository with extraneous references or objects left out.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:20:51+00:00Added an answer on May 24, 2026 at 3:20 am

    Git clone doesn’t clone dangling objects.

    And your git gc will not in any way affect the remote repo when you push to it, unless your push causes dangling objects and then a git gc is run on remote to remove those.

    Unless….

    It was a shared clone ( specified with the --shared or -s flag) or a local clone (--local or -l). From the docs:

    -l

    When the repository to clone from is on a local machine, this flag
    bypasses the normal “git aware” transport mechanism and clones the
    repository by making a copy of HEAD and everything under objects and
    refs directories
    . The files under .git/objects/ directory are
    hardlinked to save space when possible. This is now the default when
    the source repository is specified with /path/to/repo syntax, so it
    essentially is a no-op option. To force copying instead of hardlinking
    (which may be desirable if you are trying to make a back-up of your
    repository), but still avoid the usual “git aware” transport
    mechanism, –no-hardlinks can be used.

    -s

    When the repository to clone is on the local machine, instead of
    using hard links, automatically setup .git/objects/info/alternates to
    share the objects with the source repository. The resulting repository
    starts out without any object of its own.

    NOTE: this is a possibly dangerous operation; do not use it unless
    you understand what it does. If you clone your repository using this
    option and then delete branches (or use any other git command that
    makes any existing commit unreferenced) in the source repository, some
    objects may become unreferenced (or dangling). These objects may be
    removed by normal git operations (such as git commit) which
    automatically call git gc –auto
    .

    So when you do a git clone /path/to/repo you are copying the objects ( or creating hardlinks) and you will get the dangling object in this case. In other cases ( using git protocols, ssh, file protocol etc. ) you will never get the dangling objects in the clone.

    Look here for how the transport happens – http://progit.org/book/ch9-6.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wasn't quite sure how to word this question so my apologies if it
Okay I wasn't really sure how to word this question, but basically what I
Wasn't too sure exactly how to title this question, but here's the issue that
I wasn't sure how to word this exactly. But I have a model that
I wasn't sure how to word the question for this topic...sorry. I'm just starting
Wasn't really sure how to word the question ... I have a project and
I wasn't sure how to word this question, so i'll just explain. I want
I wasn't sure how to word the title to this well, apologies if the
I wasn't sure what the best way to word this question is but basically
I wasn't sure how to express my question in a way that would make

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.