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 953039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:59:15+00:00 2026-05-15T23:59:15+00:00

I cloned a project from github with git clone –mirror . That left me

  • 0

I cloned a project from github with git clone –mirror. That left me with a repository with a packed-refs file, a .pack and an .idx file. For developement purposes I want to look at the loose objects, so I unpacked the objects with git unpack-objects < <pack file> which worked fine (I unpacked the pack file into a new repo if you’re wondering). Only thing is that refs/heads/ is still empty, all the refs are still only in packed-refs but I need them in refs/heads/.
I wasn’t able to find a command that would extract or unpack those references and I can somehow not believe that I would have to do this by hand (or via pipes).

So actually I have two questions:

  1. Is there an easy way to “restore” refs from packed-refs?
  2. If not, why isn’t there? If there’s a command for unpacking objects, what is the reasoning behind not providing the same for refs (don’t forget that there’s even a command git pack-refs…)

Thanks for any tips and ideas.

  • 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-15T23:59:15+00:00Added an answer on May 15, 2026 at 11:59 pm

    The short answer is “no” – there is no “easy way” to unpack the refs the way you’re asking.

    The slightly longer answer is, each ref is just a 41-byte text file (40 byte SHA1 in hex + newline) in a specific path, so the “hard” version just requires something like this in your ~/.gitconfig:

    [alias]
    unpack-refs = "!bash -c 'IFS=$''\\n''; for f in $(git show-ref --heads); do /bin/echo ''Writing  '' $(echo $f | cut -c42-); echo $(echo $f | cut -c1-40) > \"${GIT_DIR:-.git}/$(echo $f | cut -c42-)\"; done'"
    

    Took a little trickiness to figure out how to get it to work properly, but there you go! Now you have ‘git unpack-refs’ and it does what you expect, and as a bonus it even works with $GIT_DIR if that’s set (otherwise it assumes you’re in the root of the git tree). If you haven’t read up on git aliases, https://git.wiki.kernel.org/index.php/Aliases is a great reference and even includes an example ‘git alias’ extension you can use to extend your own aliases.

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

Sidebar

Related Questions

I would like to clone a git project (from github, say), and have the
Repository A: migrated to git from a project's SVN at revision r : cloned
I accidentally added a cloned git repository to a working copy clone of my
I have cloned a Git project into a local Git repository. Then I have
When I try to clone a project from the GitHub, it gives me the
I forked a project in github and then did a git clone on this
Hi I'm trying to clone my project from github repo. I've added Public Key,
I've cloned some project from github, to my project, all works good, I'm happy.
Note: the test project I'm mentioning can be downloaded with: git clone https://github.com/mperdikeas/so-spring-di-appcontext-schemalocation.git ..
I have cloned a remote SVN repository with git-svn. I have modified a pom.xml

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.