* How to create independent branches
2006-04-07 19:18 ` Junio C Hamano
@ 2006-04-08 18:02 ` Peter Baumann
2006-04-08 18:28 ` Jakub Narebski
2006-04-08 20:49 ` Junio C Hamano
0 siblings, 2 replies; 9+ messages in thread
From: Peter Baumann @ 2006-04-08 18:02 UTC (permalink / raw)
To: git
On Fri, Apr 07, 2006 at 12:18:27PM -0700, Junio C Hamano wrote:
> Peter Baumann <peter.baumann@gmail.com> writes:
>
> > How can I get the inital commit as a patch?
>
> format-patch is designed to get a patch to send to upstream, and
> does not handle the root commit. In your two revisions
> repository, you could do something like this:
>
> $ git diff-tree -p --root master~1
>
> Or more in general:
>
> $ git rev-list master |
> git diff-tree --stdin --root --pretty=fuller -p
>
> BTW, I've been meaning to add --pretty=patch to give
> format-patch compatible output to diff-tree, but haven't got
> around to actually do it. Another thing I've been meaning to do
> is "git log --diff" which is more or less "git whatchanged".
>
Ok. That did it.
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
I looked all over the docs, but can't find anything obvious.
-Peter
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to create independent branches
2006-04-08 18:02 ` How to create independent branches Peter Baumann
@ 2006-04-08 18:28 ` Jakub Narebski
2006-04-09 8:11 ` Peter Baumann
2006-04-08 20:49 ` Junio C Hamano
1 sibling, 1 reply; 9+ messages in thread
From: Jakub Narebski @ 2006-04-08 18:28 UTC (permalink / raw)
To: git
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, or even
empty repository state at the beginning, and branch there? Or make separate
repository?
--
Jakub Narebski
Warsaw, Poland
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to create independent branches
2006-04-08 18:02 ` How to create independent branches Peter Baumann
2006-04-08 18:28 ` Jakub Narebski
@ 2006-04-08 20:49 ` Junio C Hamano
2006-04-08 20:57 ` Petr Baudis
1 sibling, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2006-04-08 20:49 UTC (permalink / raw)
To: Peter Baumann; +Cc: git
Peter Baumann <peter.baumann@gmail.com> writes:
> 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
>
> I looked all over the docs, but can't find anything obvious.
My "todo" branch is not even part of my main git repository. I
just have two independent repositories (git and todo) locally,
and push into the same public repository.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to create independent branches
2006-04-08 20:49 ` Junio C Hamano
@ 2006-04-08 20:57 ` Petr Baudis
2006-04-08 21:00 ` Junio C Hamano
2006-04-08 22:09 ` Johannes Schindelin
0 siblings, 2 replies; 9+ messages in thread
From: Petr Baudis @ 2006-04-08 20:57 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Peter Baumann, git
Dear diary, on Sat, Apr 08, 2006 at 10:49:04PM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Peter Baumann <peter.baumann@gmail.com> writes:
>
> > 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
> >
> > I looked all over the docs, but can't find anything obvious.
>
> My "todo" branch is not even part of my main git repository. I
> just have two independent repositories (git and todo) locally,
> and push into the same public repository.
Wouldn't it be better to separate it to two distinct public repositories
as well? It's confusing people and encouraging a practice that really
isn't very feasible and practical in Git.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time. I think
I have forgotten this before.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to create independent branches
2006-04-08 20:57 ` Petr Baudis
@ 2006-04-08 21:00 ` Junio C Hamano
2006-04-08 22:09 ` Johannes Schindelin
1 sibling, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2006-04-08 21:00 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
Petr Baudis <pasky@suse.cz> writes:
> Wouldn't it be better to separate it to two distinct public repositories
> as well? It's confusing people and encouraging a practice that really
> isn't very feasible and practical in Git.
That's mainly historical. I haven't bothered to check it
recently, but /pub/scm/git was not writable by me on kernel.org
machine, only /pub/scm/git/git.git/ was.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to create independent branches
2006-04-08 20:57 ` Petr Baudis
2006-04-08 21:00 ` Junio C Hamano
@ 2006-04-08 22:09 ` Johannes Schindelin
1 sibling, 0 replies; 9+ messages in thread
From: Johannes Schindelin @ 2006-04-08 22:09 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
Hi,
On Sat, 8 Apr 2006, Petr Baudis wrote:
> Dear diary, on Sat, Apr 08, 2006 at 10:49:04PM CEST, I got a letter
> where Junio C Hamano <junkio@cox.net> said that...
> >
> > My "todo" branch is not even part of my main git repository. I
> > just have two independent repositories (git and todo) locally,
> > and push into the same public repository.
>
> Wouldn't it be better to separate it to two distinct public repositories
> as well? It's confusing people and encouraging a practice that really
> isn't very feasible and practical in Git.
How so? I find it highly practical, and do it myself. For example, I track
a project which is not version-controlled at all. So I have a "branch" in
git where I keep the tools to fake that version-controlling. And git makes
it easy to just fetch the changes of both the project and my tools.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to create independent branches
@ 2006-04-08 23:15 colin
0 siblings, 0 replies; 9+ messages in thread
From: colin @ 2006-04-08 23:15 UTC (permalink / raw)
To: peter.baumann; +Cc: git
669 git-symbolic-ref HEAD refs/heads/slave
670 echo "ref: refs/heads/master" > .git/HEAD
671 git-symbolic-ref HEAD refs/heads/slave
672 git add bar
> 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
>
> I looked all over the docs, but can't find anything obvious.
If I undertstand, you basically want to create a second
initial commit, so you have two trees in your repository.
Well, an initial commit is just a commit object with no parents.
Try:
- Set up the workdir the way you want. You have to git-add
any newly added files, but git-update-index (called by
git-commit -a) will remove from the index any files
removed from the working directory, so you don't have to
worry about those.
- Make sure refs/heads/todo doesn't exist
- "git-symbolic-ref HEAD refs/heads/todo"
This makes HEAD a symlink (well, symref) to refs/heads/todo,
which doesn't exist.
- git-commit -a
Since the HEAD link doesn't exist, this does an initial
commit.
It's not supremely user friendly, because multiple initial commits can
lead to problems down the road trying to merge, so you'd better know what
you're doing.
Another option is to just set up a second working directory, with a
shared object store, and do the checkin from there. You can have the
.git/refs directories shared (via a symlink) or not. If they're not
shared, you can later make them shared by copying over the relevant refs.
Oh, yes, note that if you fat-finger the "git-symbolic-ref HEAD" command,
any attempts to fix it will complain "not a git repository".
That's because a reference to refs/heads/ in HEAD is how git
identifies a repository. "echo ref: refs/heads/master > .git/HEAD"
will fix it.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to create independent branches
2006-04-08 18:28 ` Jakub Narebski
@ 2006-04-09 8:11 ` Peter Baumann
2006-04-09 8:22 ` Peter Baumann
0 siblings, 1 reply; 9+ messages in thread
From: Peter Baumann @ 2006-04-09 8:11 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
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?
-Peter
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to create independent branches
2006-04-09 8:11 ` Peter Baumann
@ 2006-04-09 8:22 ` Peter Baumann
0 siblings, 0 replies; 9+ messages in thread
From: Peter Baumann @ 2006-04-09 8:22 UTC (permalink / raw)
To: git
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
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2006-04-09 8:22 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-08 23:15 How to create independent branches colin
-- strict thread matches above, loose matches on Subject: below --
2006-04-07 18:47 Can't export whole repo as patches Peter Baumann
2006-04-07 19:18 ` Junio C Hamano
2006-04-08 18:02 ` How to create independent branches Peter Baumann
2006-04-08 18:28 ` Jakub Narebski
2006-04-09 8:11 ` Peter Baumann
2006-04-09 8:22 ` Peter Baumann
2006-04-08 20:49 ` Junio C Hamano
2006-04-08 20:57 ` Petr Baudis
2006-04-08 21:00 ` Junio C Hamano
2006-04-08 22:09 ` Johannes Schindelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).