From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: martin f krafft <madduck@madduck.net>
Cc: git discussion list <git@vger.kernel.org>
Subject: Re: how to combine two clones in a collection
Date: Wed, 11 Jul 2007 19:37:10 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0707111929120.4516@racer.site> (raw)
In-Reply-To: <20070711181301.GA26815@piper.oerlikon.madduck.net>
Hi,
On Wed, 11 Jul 2007, martin f krafft wrote:
> also sprach robin:
> > And the simplest way to create an new indpendent branch:
>
> > echo ref: refs/heads/newbranch >.git/HEAD
> > Then prepare the content and commit like you used to do.
>
> I am a little uneasy about touching files in .git with non-git
> tools, but everyone seems to be doing it, so I guess it's okay, and
> it make git a lot more powerful too.
You can achieve the same with
git symbolic-ref HEAD refs/heads/newbranch
There. No editing in .git/.
> piper:~> echo ref: refs/heads/newbranch >| .git/HEAD
> piper:~> git status
> # On branch newbranch
> #
> # Initial commit
> #
> # Changes to be committed:
> # (use "git rm --cached <file>..." to unstage)
> #
> # new file: date
> #
However, this is much easier without Git commands:
rm .git/index
Of course, you can remove all files one by one, but that is certainly not
easier:
git ls-files --cached -z | xargs -0 git rm --cached
But then, you really can learn from both examples: .git/index contains
references to the objects which are staged (in Git speak: "in the index").
Git plays nicely when that file is missing, and assumes the index to be
empty.
With "git ls-files --cached", you can list the files which are in the
index, and with "git rm --cached", you remove the file _only_ from the
index, but keep it in the working tree (if it is there). The options "-z"
and "-0" are only to separate the names by NUL instead of newlines, to
allow funny file names, too.
If a few more people ask for that feature, we could enhance the semantics
of "git branch" and "git checkout" to interpret the empty string
similar to "git push <repo> :<name>".
Ciao,
Dscho
next prev parent reply other threads:[~2007-07-11 18:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-09 22:22 how to combine two clones in a collection martin f krafft
2007-07-10 2:35 ` Linus Torvalds
2007-07-10 6:21 ` martin f krafft
2007-07-10 7:17 ` Junio C Hamano
2007-07-10 7:40 ` martin f krafft
2007-07-10 7:51 ` Martin Langhoff
2007-07-10 17:05 ` Linus Torvalds
2007-07-10 17:45 ` martin f krafft
2007-07-10 18:27 ` Brian Gernhardt
2007-07-10 19:27 ` Kalle Pokki
2007-07-10 20:00 ` Brian Gernhardt
2007-07-10 23:45 ` Robin Rosenberg
2007-07-11 18:13 ` martin f krafft
2007-07-11 18:37 ` Johannes Schindelin [this message]
2007-07-11 19:22 ` martin f krafft
2007-07-11 10:46 ` Jakub Narebski
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=Pine.LNX.4.64.0707111929120.4516@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=madduck@madduck.net \
/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).