Tuesday, 15 April 2014

git - Branches Missings After converting a repository to bare -



git - Branches Missings After converting a repository to bare -

i have repository number of branches. e.g.

git --branch -a *master remotes/origin/head -> origin/master remotes/origin/branch1 remotes/origin/branch2 remotes/origin/master

iconverted bare repository using method found here : how convert git repository normal bare ?

in bare repository, running same command "git branch -a ", branches listed.

git --branch -a *master remotes/origin/head -> origin/master remotes/origin/branch1 remotes/origin/branch2 remotes/origin/master

once clone bare repository, branches gone. running git --branch -a shows:

git clone git-server git-local cd git-local git --branch -a *master remotes/origin/head - origin/master remotes/origin/master

is there i'm missing? how branches back?

they're not "missing": they're deliberately not taken in new clone.

another way set bare repository has 1 branch, master. other things see (remotes/origin/branch1 , on) not branches, "remote branches". (these names unfortunately similar. can qualify local branches word "local" distinguish them "remote branches". way set clone copies local branches.)

remember every clone independent git repository.1 thought create clone , modify yourself. changes purely yours, until decide publish (share) them. clone starts out re-create of thing you're cloning, gets changed own work.

whether or not alter your copy, @ point might pick changes else has published (shared). git's "remote branches" come in. private repository re-create have own personal, local branches, you create , maintain. wherever copied originally—i.e., origin—is also independent repository. person copied from—let's phone call guy bob, has name—may have made changes , decided allow share them. pick bob's changes, put, in your copy, set of "remote branches" maintain track of bob's repository's branches were.

these remotes/origin/ branches see, such remotes/origin/master. have, or @ to the lowest degree had, access bob's repository, because you cloned it create repository. git repository records url bob's under remote name origin (the origin of clone).

let's else, clara example, clones your repository. get, her "remote branches", your (local) branches. not bob's branches because clara not copying bob's repository. gets your branches, on repository, live under remotes/origin/. gets your master , calls remotes/origin/master. has nil your remotes/origin/master, , clone utilize track bob's work in bob's master.

if create your repository pick bob's changes, , integrate of bob's changes your local branches, @ point clara can pick branches, same bob's branches, , grab bob. through you.

should clara realize bob exists , decide pick stuff directly, may record remote in clone. let's calls remote bob:

$ git remote add together bob ssh://whatever... # whatever url appropriate

clara can run git fetch bob contact bob's scheme , pick local branches. in git repository, these called remotes/bob/: acquire remotes/bob/master, instance. clara can compare remotes/bob/master , remotes/origin/master in her repository see whether have been keeping your master date bob's master: remotes/origin/master re-create of master of lastly time re-synchronized you, , remotes/bob/master re-create of bob's master of lastly time re-synchronized bob.

in short, clone not re-create remotes/ branches because makes no sense. people making clone have access your repository—the 1 they're cloning—and not care whether repository has access other repository. care your branches—at least, until add together more remotes.

1at least, independent-in-principle. can create "shallow" clones incomplete. these still independent, have backward references cannot resolved without contacting repository first, "deepen" copy. non-shallow ("fully deep", were) clone has though, , independent.

git git-branch

No comments:

Post a Comment