MarcSchaetz
MarcSchaetz

Reputation: 494

Merge unrelated branches branches from SVN to Git conversion

I converted a project from SVN to Git. This project had a few branches which I think where just copied into /branches. That now related to detached branches that have no connection to the master branch.

In the Graph it looks like this

                             HEAD
Master    o--------------o----o

Branch A       o----o

Is there any possibility which lets me achieve that the Master has a connection to the detached branch?

                             HEAD
Master    o--------------o----o
           \
Branch A    o----o

Upvotes: 2

Views: 120

Answers (1)

VonC
VonC

Reputation: 1323953

One option would be to rebase A to master (assuming you want branch A to origin from master, as opposed to be merged in master: it is not clear from your diagram where is master HEAD, the most recent commit)
See How to re-apply commits on top of unrelated branch?

git rebase A1 A2 --onto M --committer-date-is-author-date

With:

  • A1: oldest commit from branch A
  • A2: current A HEAD (most recent commit)
  • M: an old commit from master you want A to be created from

Upvotes: 2

Related Questions