Re: need to create new repository initially seeded with several branches
On 08/31/2011 11:54 AM, Jeff King wrote:
Show 36 quoted lines
> On Wed, Aug 31, 2011 at 11:14:48AM -0500, Brandon Casey wrote:
>
>> git checkout -b devel && # make a new branch named "devel"
>> # which has the same state as the
>> # currently checked out branch: "master"
>> # i.e. devel and master point to the
>> # same tip commit.
>> rm -rf * && # remove the files in the working dir
>> cp -a $devel_dir/* . && # cp devel source code to working dir
>> git add -A . && # add new/removed files to the index
>> # to be committed on next 'git commit'
>> git commit
>> # use editor to give descriptive commit message
>>
>> Repeat for your topic branch based off of devel.
>
> I am probably just going to confuse the original poster more, but here
> is how I would do it. It's slightly more efficient, as it doesn't
> involve removing and copying files for the intermediate states:
>
> # make a repo and switch to it
> git init repo && cd repo
>
> # and now add everything from the "master" version, and
> # make a commit out of it
> GIT_WORK_TREE=/path/to/master git add -A
> git commit
>
> # now make the devel branch and do the same
> git checkout -b devel
> GIT_WORK_TREE=/path/to/devel git add -A
> git commit
>
> # and then check out the result in the working tree of
> # your newly created repo
> git checkout -f