[cmake-developers] git branches and cmake build trees

Michael Wild themiwi at gmail.com
Fri Apr 9 15:39:27 EDT 2010

On 9. Apr, 2010, at 21:30 , Alexander Neundorf wrote:

> Hi,
> what is a good way to handle git branches and cmake build trees ?
> With cvs/svn, I check out the branches I want into different source 
> directories, and then create build directories. Each build directory is tied 
> to a source directory, which is via CVS/svn tied to a branch.
> How do I handle this with git ?
> If I understand correctly, the idea with git is to have 1 cloned repository 
> locally, and then create all the branches I need in this repository, and then 
> switch between the branches while staying in the same source directory and 
> just use git to switch the branch.
> But this means that if I want build trees for different branches, then they 
> all refer to the same source directory ? And I have to take care manually 
> that my (one) source directory is in the right branch currently ?
> To have multiple source directories, I need multiple clones, right ? 
> Does this mean I have to clone the cmake repository once for each branch I 
> want ?
> How do you handle this ?
> Alex

When you clone locally, git by default uses hard-links in in the newly created .git folder to save space. Also, there's the --shared option which causes it to actually share the local repository, but this can be dangerous, as is explained by "git help clone".

Personally, I simply "git clone" my local master repository for all the topic branches, push them to the master-repo and from there to the remote repositories.



More information about the cmake-developers mailing list