Re: Problematic git pack

From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Date: 2006-08-31 21:15:07
Hi,

On Thu, 31 Aug 2006, Sergio Callegari wrote:

> Now I am going to have the fixed archive and also a new archive, which I
> restarted from the latest working copy I had of my project.
> Is there any way to automatically do real "surgery" to attach one to the other
> and get a single archive with all the history?

You can "graft" the new onto the old branch:

If <40-hex-chars-old> is the commit id of the youngest commit of the 
reconstructed branch, and <40-hex-chars-new> is the commit id of the 
initial commit of the newly started branch, you can put this line into 
.git/info/grafts:

<40-hex-chars-new> <40-hex-chars-old>

This will make git believe that the initial commit is no initial commit, 
but has the old head as single parent. And yes, AFAICT all git tools 
support this. I used this technique many times to be able to merge 
unrelated developments.

NOTE! This is the quickest way if you want to have the history _locally_.

If you want to be able to distribute it (or synchronize it between your 
laptop and PC _with git!_), you can rewrite the history by either 
git-rebase, or by using cg-admin-rewritehist if you are using cogito.

Unfortunately, I do not use cogito nor git-rebase, so if you want to walk 
that path, others have to help. (And most likely, we'd put the result into 
Documentation/howto/.)

Ciao,
Dscho

P.S.: Of course, if you do not insist on a super clean history, you can 
fake a merge. Just put <40-hex-chars-old> into .git/MERGE_HEAD and commit. 
This will pretend that your new head and your old head were merged, and 
the result is the new head. This _should_ even work with git-bisect, but 
it is slightly ugly.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Thu Aug 31 21:15:51 2006

This archive was generated by hypermail 2.1.8 : 2006-08-31 21:16:36 EST