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

I cloned a repo using the

git clone -b <branch name> --single-branch <github url> <target directory>

  • Push subfolder to ftp using git-ftp
  • Unable to run TortoiseGit + cntlm + proxy server
  • Git merge flattening
  • How can I reorder/combine commits using Git rebase?
  • Storing Jenkins configuration for multiple environments
  • Copying only files from git tag
  • This cloned ONLY this branch, but now I want to switch to the master and other branches. Is there any way besides clearing it out and starting over to clone the rest of the repo that I can undo the –single-branch preference?

  • How to decompose git pull <REMOTE> <BRANCH> into a fetch + merge?
  • Git: ignore some files during a merge (keep some files restricted to one branch)
  • Git workflow: “Your local changes would be overwritten by merge”
  • What's the difference between SVN and Git for merging?
  • Local only, revision/version/source control
  • Heroku deploy a sub directory?
  • 4 Solutions collect form web for “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:

        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = false
    [remote "origin"]
        url =
        fetch = +refs/heads/master:refs/remotes/origin/master
    [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.

    If you want to add a single branch, you can do the following:

    git remote set-branches --add origin [remote-branch]
    git fetch origin [remote-branch]:[local-branch]

    Works with git version 1.9.1

    Just add the original repo as a new remote, and work off of there?

    git remote add path/to/myrepo myNewOrigin
    git fetch myNewOrigin

    You can even delete your current ‘origin’ remote and rename ‘myNewOrigin’ to ‘origin’ if you would want to.

    From there you can pull/merge/rebase.

    You can very easily download all branches but using git pull origin *:*

    Git Baby is a git and github fan, let's start git clone.