2

Hi guys I'd like to hear your opinions. I have a situation we have migrated to git recently. After first migration and some development works have been done, We just notice that migration had went wrong. We re-created a new repository.

The problem here is commit hash is all different between repositories.

I would like to merge only our development works with full commit history from current master branch to new repository. What is the best option should I take? Simply if I add two remotes and merge, git creates whole new commits. patch? cherry-pick?

1 Answer 1

1

You can add a second remote (git remote add) to your old repo, fetch it, and cherry-pick all the commits done in that old repo to your master branch of your new repo.

2
  • Thanks. It seems to work. I was doing opposite way. I added a second remote to my new repo on old repo. I could cherry-pick commits and pushed them to remote master but rejected. Why? Oct 17, 2014 at 11:50
  • @KenichiTakemura probably (it depends on the rejection massage) because of a different history. By doing it in your new repo, you create that new history directly on the target branch: nothing to push, and it just works.
    – VonC
    Oct 17, 2014 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.