robinst/git-merge-repos

No commits

Closed this issue · 6 comments

I just tried this with 2 repo's I wanted to merge but apparently I got an empty repo or something...

~/merged-repo $ git status
On branch master

No commits yet

nothing to commit (create/copy files and use "git add" to track)

Still there seems to be quite some stuff in .git...

~/merged-repo [No commits|] $ du -h --max-depth=1
354M    ./.git
354M    .

Not sure how to proceed... or did i do something wrong?

just did:

./run.sh /home/me/originalsources/source1:source1 /home/me/originalsources/source2:source2

Hey! What branches do you have, when you do git branch? If there are some branches, try git checkout $branchname.

right... i'm just stupid. Didn't see this before but apparently i do have a develop branch. and that one contains commits \o/
only...
I only see our develop branch... none of the feature branches...

No worries :). Your source repositories should contain all the branches as normal branches, not remote ones. So if you use your normal working repos as source, that probably won't work. Try cloning the source repos like this first:

git clone --mirror git@example.org...

Then use those as the source for the run command.

ok super. that worked! thanx a lot.

Not really completely related, but i have no other way to contact you...
i have 3 repos (a, b and c ). I ran your program on them and for common branches everything is good... i have a develop branch in the 3 repos and the new merged-repo contains a develop branch. good
Now for branches that only exist on repo b. I thought by just merging the develop branch in there i would be clear to go... but apparently i have a ton of conflicts if i do that... Do you have any solution for that? I've tried with a couple of merge strategy options but no avail.

Cool. Should probably be more clear in the README. If you wanna submit a PR that would be cool.

Yeah, merging of branches in the new repo doesn't really work nicely due to the way it's done. If you want that you can try the option where you run filter-branch first, see here: https://github.com/robinst/git-merge-repos#preserve-history-for-paths

Another option is merging the branch in the original repo first. Then, in the combined repo you can do a merge that doesn't change any files but creates a merge commit, like this: git merge --strategy ours develop. After that, the next merge should work.