How do I “undo” a –single-branch clone?

You can tell Git to pull all branches like this:

git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin

If you look in .git/config, it’ll look something like this:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = false
[remote "origin"]
    url = https://github.com/owner/repo.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
    rebase = true

I compared this to a full clone, and saw that the only difference was the “fetch” under [remote "origin"].

Note: I’m running Git version 1.8.2. The config options may have changed if you’re running an older version of Git. If my commands don’t work, then I’d recommend looking through .git/config to see if you can see something similar.

Leave a Comment