0

For instance, suppose a git repo has two branches, master and branchA, if branchA is cloned by using

git clone --single-branch branchA

can we recover branch master from the cloned repo? and can we see from the cloned repo history that there exists a branch master?

Abe
  • 1,357
  • 13
  • 31
Brian Xue
  • 11
  • 1

1 Answers1

0

The git clone man page can help:

--[no-]single-branch

Clone only the history leading to the tip of a single branch, either specified by the --branch option or the primary branch remote’s HEAD points at.
Further fetches into the resulting repository will only update the remote-tracking branch for the branch this option was used for the initial cloning.

If the HEAD at the remote did not point at any branch when --single-branch clone was made, no remote-tracking branch is created.

Note: you can do that for a tag as well, but do use a Git 2.11+ in that case.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250