git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Markus Hitter <mah@jump-ing.de>
Cc: git@vger.kernel.org
Subject: Re: Binary files in a linear repository
Date: Mon, 2 Nov 2009 16:34:28 +0100	[thread overview]
Message-ID: <20091102153428.GA4778@atjola.homenet> (raw)
In-Reply-To: <8470D32E-2CAA-4E3F-8BA0-B4578372A3C4@jump-ing.de>

On 2009.11.02 16:08:25 +0100, Markus Hitter wrote:
> The situation I'm trying to solve is:
> 
> - A revision earlier than the latest one is checked out.
> 
> - Files of this earlier commit are modified.
> 
> - I want to record this earlier commit along with it's modifications
> as a new commit on top of master, ignoring intermediate commits:
> 
> com005  <-- master
> com004
> com003  <-- HEAD, files modified
> com002
> com001 (initial commit)
> 
> One solution to do this is to move all files somewhere else, check
> out master, deleting all checked out files, placing the moved away
> files back into place and committing the result as com006.
> Obviously, this is a pretty complex operation, just waiting to
> exploit coding mistakes. Additionally, this will be slow.

Instead of doing "git checkout com003", which detaches HEAD, you could
do:
git read-tree -u --reset com003

Which will update the index and working tree to reflect the contents of
com003. The modify stuff, add, commit, done.

> Now I'm thinking about a much simpler solution: Simply declare the
> current set of files as (a modified) master/com005 and commit them.
> A "cp $GIT_DIR/master $GIT_DIR/HEAD" followed by a commit would do
> it.
> 
> Now my question: Is it safe to tweak the files in $GIT_DIR this way
> or will this corrupt the repository?

Ignoring that $GIT_DIR/master is the wrong path, that 'cp' would (at
best) act like detaching HEAD.

Björn

  reply	other threads:[~2009-11-02 15:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <S1754797AbZKBONX/20091102141323Z+268@vger.kernel.org>
2009-11-02 15:08 ` Binary files in a linear repository Markus Hitter
2009-11-02 15:34   ` Björn Steinbrink [this message]
2009-11-02 15:48   ` Dmitry Potapov
2009-11-02 16:09     ` Björn Steinbrink
2009-11-02 16:52       ` Dmitry Potapov
2009-11-02 17:01         ` Björn Steinbrink
2009-11-02 17:45           ` Dmitry Potapov
2009-11-02 18:37             ` Björn Steinbrink

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=20091102153428.GA4778@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=mah@jump-ing.de \
    /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).