From: Nicolas Richard <theonewiththeevillook@yahoo.fr>
To: peder@news.klingenberg.no (Peder O. Klingenberg)
Cc: emacs-devel@gnu.org
Subject: Re: Switching from old git tree
Date: Fri, 14 Nov 2014 14:29:33 +0100 [thread overview]
Message-ID: <877fyxc3lu.fsf@yahoo.fr> (raw)
In-Reply-To: <ks61ei81la.fsf@netfonds.no> (Peder O. Klingenberg's message of "Fri, 14 Nov 2014 12:26:41 +0100")
peder@news.klingenberg.no (Peder O. Klingenberg) writes:
> I have been using the old git-mirror for a while. In there, I have a
> branch with some local modifications.
>
> I understand that I need to check out a fresh tree now after the
> conversion? What is the smoothest way of integrating my local branch in
> this new tree? I'm a very basic git user, and the only way I can think
> of is to extract the patches from my old branch and applying them by
> hand in the new tree. Is there something else I should be doing
> instead?
Hello,
First of all, you can add the new repository as a remote of your old one
(or your old repo in your new tree, if you prefer). This means that both
old and new (rewritten) commits will live in one repository, which also
means you can use full git power instead of having to transfer patches
from one tree to the other. (although that certainly is a solution also)
Then rebasing is your friend, with its "--onto" argument.
Here's my approach. (See also "caveats" at the end)
First, find where your branch diverged from the (now deceased) official
git mirror :
MERGEBASE=$(git merge-base old-mirror-on-savannah/emacs-24 emacs-24)
In the above,
- The name of the branch old-mirror-on-savannah/emacs-24 is clear.
- "emacs-24" is my personnal branch, where I have commits
that are not in the official tree. Alternatively, you can look at the
"git log emacs-24" and write down the first SHA1 that's not a commit of
yours.
Now, you have to find a commit in the branch
emacs-new-savannah-repo/emacs-24 which looks similar to $MERGEBASE,
because that's where you want to graft your commits.
To do that, I look for an identical commit date. This is the kind of
game I can't play well, so please forgive unnecessary complicatedness :
Here's the unix timestamp of $MERGEBASE :
DATESTAMP=$(git --no-pager show -s --format="%at" $MERGEBASE)
and here is a commit which has the same timestamp :
ONTOHASH=$(git log --format="%H %at" emacs-new-savannah-repo/emacs-24 | grep $DATESTAMP'$' | head -1 | cut -d" " -f 1)
(it's awful, surely there's a better way.)
Now you can check that $ONTOHASH and $MERGEBASE are indeed "the same"
commit, and use
git rebase --onto $ONTOHASH $MERGEBASE
Then, repeat for every branch you want to rebase.
"worked for me"... at least I think so :)
--
Nicolas Richard
prev parent reply other threads:[~2014-11-14 13:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-14 11:26 Switching from old git tree Peder O. Klingenberg
2014-11-14 12:20 ` David Kastrup
2014-11-14 12:35 ` Sven Axelsson
2014-11-14 12:38 ` Sven Axelsson
2014-11-14 13:21 ` Peder O. Klingenberg
2014-11-14 13:53 ` David Kastrup
2014-11-14 14:20 ` Sven Axelsson
2014-11-14 14:54 ` David Kastrup
2014-11-14 15:52 ` Andreas Schwab
2014-11-14 18:29 ` David Caldwell
2014-11-15 8:43 ` Kenneth Raeburn
2014-11-15 8:58 ` Eli Zaretskii
2014-11-15 9:18 ` David Kastrup
2014-11-15 9:55 ` Eli Zaretskii
2014-11-15 18:26 ` Ken Raeburn
2014-11-14 13:29 ` Nicolas Richard [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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877fyxc3lu.fsf@yahoo.fr \
--to=theonewiththeevillook@yahoo.fr \
--cc=emacs-devel@gnu.org \
--cc=peder@news.klingenberg.no \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).