Re: Alter parent ID of existing commit object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Nieder <jrnieder@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]