From: Jakub Narebski <jnareb@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Paul Richards <paul.richards@gmail.com>,
git@vger.kernel.org, Christian Couder <chriscool@tuxfamily.org>
Subject: Re: Alter parent ID of existing commit object
Date: Mon, 26 Apr 2010 16:34:12 -0700 (PDT) [thread overview]
Message-ID: <m31ve1eqm1.fsf@localhost.localdomain> (raw)
In-Reply-To: <20100426103637.GA8896@progeny.tock>
Jonathan Nieder <jrnieder@gmail.com> writes:
> Hi Paul,
>
> Paul Richards wrote:
>
> > Is it possible to edit an old commit object and only alter the ID of
> > the parent commit but otherwise leave all the other information intact
> > (tree, message, authors, date, etc).
> >
> > I'd expect such a command to return the new hash of the modified commit.
>
> The standard answer to this question is to say “use grafts and
> filter-branch”. The git-filter-branch(1) man page explains this
> approach. It is very powerful, but sometimes I do not want to have
> that much power.
This also rewrites history up from the changed commit, which is
something that you need to take into account. It is IMVHO best
solution if rewritten part of history was not published, e.g. in the
case of private repository / private development.
In the case of already published history you can use "git replace"
mechanism instead (with git-cat-file + git-hash-object).
Grafts _without_ using "git filter-branch" do not rewrite history, but
are not transferrable. The modern 'refs/replaces/*' mechanism is.
Just FYI, as I guess in your situation grafts+git-filter-branch
would be best solution (after running git-filter-branch you can
remove graft).
--
Jakub Narebski
Poland
ShadeHawk on #git
prev parent reply other threads:[~2010-04-26 23:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-26 10:13 Alter parent ID of existing commit object Paul Richards
2010-04-26 10:38 ` Jonathan Nieder
2010-04-26 11:02 ` Paul Richards
2010-04-26 23:34 ` Jakub Narebski [this message]
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=m31ve1eqm1.fsf@localhost.localdomain \
--to=jnareb@gmail.com \
--cc=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=paul.richards@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).