From: colin@horizon.com
To: peter.baumann@gmail.com
Cc: git@vger.kernel.org
Subject: Re: How to create independent branches
Date: 8 Apr 2006 19:15:20 -0400 [thread overview]
Message-ID: <20060408231520.27044.qmail@science.horizon.com> (raw)
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.
next reply other threads:[~2006-04-08 23:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-08 23:15 colin [this message]
-- 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060408231520.27044.qmail@science.horizon.com \
--to=colin@horizon.com \
--cc=git@vger.kernel.org \
--cc=peter.baumann@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).