I'm trying to reorganize my code directory and merge two unrelated Git repos. Both repos are local.
I found a similar question here: How do you merge two Git repositories?
...but the solution didn't work for me. I asked in the comments sections about this and another user suggested I ask my question as a separate question.
I created a test/sandbox environment to test resolving this Git merge problem. My set up is:
/home/dir01/merge_repos # this is the sandbox dir
|
/home/dir01/merge_repos/old_dir_01/old_repo # git init was done here; .git directory exists here
/home/dir01/merge_repos/old_dir_01/old_repo/source_file_01.py
/home/dir01/merge_repos/old_dir_01/old_repo/source_file_01.py
|
/home/dir01/merge_repos/new_repo # git init was also done here.
I want to merge the files in old_repo with the Git repo in new_repo.
As per the solution offered in the original question, I did the following:
I created a dummy file under new_repo, then did a git add and git commit of this dummy file.
While in the new_repo/ directory, I issued >
git remote add old_repo /home/dir01/merge_repos/old_dir_01/old_repo
git fetch old_repo --tags
git merge --allow-unrelated-histories old_repo/master
At Step 4, Git complains that --allow-unrelated-histories
is an unknown option.
So I tried a git merge
without the --allow-unrelated-histories option. This didn't work; Git complained with fatal: old_repo/master - not something we can merge
.
My question is, can I do a Git merge of two unrelated Git repos using a Git version that is older than v2.9?
I'm using Git v1.8.3.1.