Re: need to create new repository initially seeded with several branches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 31, 2011 at 8:40 AM,  <in-git-vger@xxxxxxxx> wrote:
>
> In message <1314804325568-6746957.post@xxxxxxxxxxxxx>, "ryan@xxxxxxxxxxxxxxxx" writes:
>
>    I would like to turn this into a git repository.  One branch being master,
>    the second develop and finally a third branch that is extended off the
>    develop branch.
>
> I will assume in my instructions that develop is "extended" off of master.
>
> ----------------------------------------------------------------------
> cd /path/to/new/master
> # Make this a git repo
> git init
> # Add all files to git
> git add .
> # Commit all files to git
> git commit -m "initial master version"
> # Make new develop branch
> git checkout -b develop
> # Cause git to delete all files in the internal index
> git read-tree --reset -i 4b825dc642cb6eb9a060e54bf8d69288fbee4904
> # Cause git to delete all files in the working directory
> git clean -dfx
> # Copy all files from the develop directory
> cp -r /path/to/new/develop .
> # Add all files to git (and delete them too)
> git add -A .
> # Commit
> git commit -m "Initial develop branch"
> # Make new extended branch
> git checkout -b extended
> # Cause git to delete all files in the internal index
> git read-tree --reset -i 4b825dc642cb6eb9a060e54bf8d69288fbee4904
> # Cause git to delete all files in the working directory
> git clean -dfx
> # Copy all files from the extended directory
> cp -r /path/to/new/extended .
> # Add all files to git (and delete them too)
> git add -A .
> # Commit
> git commit -m "Initial develop branch"
> ----------------------------------------------------------------------
>
> The only "magic" is the read-tree/git-clean stuff.  The 4b82… value is
> the SHA of an empty tree.  It could be replaced by a:
>
> find . -maxdepth 1 ! -name '.git' -a ! -name '..' -a ! -name '.' -print0 | xargs -0 rm -rf
>
> But that is 9 extra characters.
>
> Untested, but it should work.
>
>                                        -Seth Robertson
>

Seth-
Thanks for the extensive reply.  I am excited that this is even possible.

I have to say that I am lost by the "magic" you describe.  I don't
understand what you mean by the 4b82... value should be replaced by
the find | xargs remove all command.   That command looks like it just
deletes all the "." file names?  But when you say replace I thought
you would mean I need to generate a new value to replace that magic
number??  Confused...
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]