Search code examples
gitgit-rev-listgit-bundle

git bundle with symbolic ref


I'm trying to share our git repo with an offsite development team. We do not have a "master" branch. We have A/master, B/master, and C/master. I have a symbolic ref in my pub repo

HEAD -> refs/heads/B/master

When I create the bundle git bundle create my.bundle --remotes --tags I end up with two references to refs/remotes/origin/B/master and that causes git clone --mirror my.bundle to fail. Is there a way to ignore the symbolic ref?


Solution

  • I'd probably use:

    git bundle create my.bundle \
        $(git rev-parse --symbolic-full-name --remotes --tags | grep -v HEAD)
    

    or something along these lines. (The line break with backslash is mostly for posting purposes, and watch out for this removing too many HEAD entries, e.g., if you have a remote-tracking name or tag name like getAHEADofit.)