kbanman kbanman - 3 months ago 21
Git Question

Git - Store branches in separate local directories

I'm rather new to git, and am trying to set up my repository the right way.

Basically my app is a platform of sorts, so implementations of this platform are based on the master branch, but have some small modifications to those files as well as some additional files.

I tried setting it up as branches, so I have a


But as far as I can tell, that would mean that locally all the branches are stored in one directory, with their separation being only through git.

What I would like is to have 3 local directories,
, and
. If I make a change to one of the core files in the
directory, I want to be able to merge that change into the
branch and from there into

I'm beginning to think these need to be 3 different repositories (the implementations being forks of the core). Is that the way to go? In that case, how would I go about handling the above scenario?


Branch are first class citizen in Git, meaning there are not "emulated" as branches like in older VCS (SVN, CVS, ...)

If you really need three different directories, because you want to have three distinct development environment, make 3 clones:

  • one in a directory called master
  • one in a directory called imp_1
  • one in a directory called imp_2

But to really understand branches, you can read "Pros and cons of different branching models in DVCS".