On Saturday, December 5, 2015 at 1:49:29 PM UTC-6, Rainer M Krug wrote:
> > On Friday, December 4, 2015 at 7:00:20 AM UTC-6, Rainer M Krug wrote:
> >> Hi
> >> I have an git repository which begins with refactored code from a
> >> different project. The refactored code is only available as the latest
> >> version due to git and svn hosters which shutdown and I missed
> >> notifications as well as a stolen hard drive on which the local repos
> >> were.
> >> I now did some cleaning up of the older code and created a git repo for
> >> it.
> >> Further development happened in a new repo with the first commit being
> >> refactored code. After that, several commits were done.
> >> So: I now have a repo A which contains old history, and a repo B which
> >> effectively starts where repo A ends.
> >> To simplify things, I would like to combine these two, i.e. have one
> >> repo (let's call it AB) which contains the complete history of the two
> >> repos, (beginning of A until end of B) and in which I can tag the end
> >> A.
> >> But I have no idea if this is possible or if h=yes, how I can do this.
> >> Any help welcome,
> >> Thanks,
> >> Rainer
> >> --
> >> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
> >> Biology, UCT), Dipl. Phys. (Germany)
> >> Centre of Excellence for Invasion Biology
> >> Stellenbosch University
> >> South Africa
> >> Tel : +33 - (0)9 53 10 27 44
> >> Cell: +33 - (0)6 85 62 59 98
> >> Fax : +33 - (0)9 58 10 27 44
> >> Fax (D): +49 - (0)3 21 21 25 22 44
> >> Skype: RMkrug
> >> PGP: 0x0F52F982
> > It seems to me you must choose between
> > 1. rewriting your history of B on top of A
> > (resulting in one linear history x...A...B')
> This sounds like what I am looking for - One repo with a linear history
> Beginning A - End A - Beginning B - End B.
> And If I checkout End A I will the current state of A, and checking out
> HEAD, I will get the head of B.
> The history of A is pre-panded to the history of B.
What you want is to rebase B on top of A, which will rewrite B's history
with A as the parent.
Note I have not tested the below, I encourage you to explore the commands'
man pages before executing.
Assuming A and B are in separate repos, starting in your local clone of A,
add a "remote" to B and fetch it with:
* git remote add RepoB REPO_B_URL * # same URL for cloning B's repo
* git fetch RepoB B*
Now you should create a local branch B and rebase it on top of A
* git checkout -b B RepoB/B git log -1 --decorate #
verify you have B checked out*
*git rebase -i A # an editor will pop up here*If
you have conflicts, that means A and B had changes that cannot coexist.
Remember you are replaying B on top of A, so you might find some commits in
B's past may not apply on the latest commits in A. In this case you may
want to reconsider your strategy - did B *really* contain only changes
*after* A went dormant?
Once you are done, push your new B to either RepoB or RepoA:
* git push RepoB B:B*
> > 2. merge your two repos
> > (resulting in merge M with parents HEAD(A) and HEAD(B))
> Sorry - I don;t understand what you mean here.
> > Once you decide the recipe will follow
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
> Biology, UCT), Dipl. Phys. (Germany)
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
> Tel : +33 - (0)9 53 10 27 44
> Cell: +33 - (0)6 85 62 59 98
> Fax : +33 - (0)9 58 10 27 44
> Fax (D): +49 - (0)3 21 21 25 22 44
> Skype: RMkrug
> PGP: 0x0F52F982
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.