Subject: Re: How to create independent branches

From: Peter Baumann <[email-masked]>
Date: Sun, 9 Apr 2006 10:22:48 +0200

On Sun, Apr 09, 2006 at 10:11:05AM +0200, Peter Baumann wrote:
> On Sat, Apr 08, 2006 at 08:28:58PM +0200, Jakub Narebski wrote:
> > Peter Baumann wrote:
> > 
> > > Another question. I'd like to create a totaly independent branch (like
> > > the "todo" branch in git). Is there a more user friendly way than doing
> > > 
> > > git-checkout -b todo
> > > rm .git/refs/heads/todo
> > > rm .git/index
> > > rm <all_files_in_your_workdir>
> > > 
> > > ... hack hack hack ...
> > > git-commit -a
> > 
> > Wouldn't it be better and more natural to go back to first commit? > 
> 
> If I go back to the first commit, I'll get the following:
> 
> 	first
> 	 / \
> 	/   \
>    master    todo
> 
> That's not what I want, because in the near future I want to merge
> master and todo, but in my case, todo consists of only of one file (lets
> call it file_a), and the master branch has severeal files (file_{a..z}).
> If I go back to first, I have to delete all files file_{b..z}.
> Further file_a from todo and file_a from master are not equal, the share
> just the same name. But in the near future, they will be merged
> together, so they are equal.
> 
> If I go with the above branching, I'll _think_ (I may be wrong, please
> correct me if I am) I get a merge conflict or worse, all my other files
> file_a{b..z} are merged as "deleted", wich is wrong.
> 
> > Or even empty repository state at the beginning, and branch there?
> 
> This isn't possible because the repository already exists and I don't
> know how to go back to the empty repository state. Even 
> 
> 	git-init-db
> 	git branch todo master
> 
> didn't work.
> 
> > Or make separate repository?
> 
> Ok. You got it. In fact, the todo branch alread exists as a seperate
> repository and I'd like to integrate this in my master repository for
> easier handling (diff etc.)
> 
> To import todo as a subproject doesn't seem right, because it's not
> something really independent in the view of the master repo and I'am
> going to merge todo _into_ master in the near future.
> 
> Any further suggestions?
> 

Just in case nobody noticed, that's why I asked for exporting the whole repo
with git-format-patch in the first place, because I'd like to import the 
patches with git-am in the totally independent branch.

Peter