Can I merge 2 similar, but non tracked repositories in Git?
I have a mainline repository which I want to merge my new features into. These features were developed on a copy of this repo. The way this repo was created was by simply doing a git init and dropping a copy of everything in there (ie: no history from the mainline is there, the first commit is just a straight copy of everything). I know that I can bring the feature repo into the mainline repo as a new branch BUT… I seem to just get
both added conflicts for any files that have changes in both. Also, I am not sure if my history will be brought over from the feature repository, into the mainline repository? Will it just be seen as a single, large commit? Is there a way to do this the kosher way despite my previous mistake?
One Solution collect form web for “Can I merge 2 similar, but non tracked repositories in Git?”
It sounds like you have made commits on the “mainline” repo since you started working on the “new features” repo. If this be the case, you will need to create a branch in the mainline repo from the commit that started the new repo, not the current commit.
---o---o---o mainline \ o---o---o new features
cd mainline git checkout -b new-features <origin commit for new features> git remote add new-features ../new-features
From there should you be able to
git rebase /
git merge /
git cherry-pick to your liking. Also going forward, dont do what you did. If you want to “branch” then use