This is a small learning about git.
- local git copies
Unrelated histories may happen sometimes. Usually, we use git init command and create a git repo. This has some unique identity (I didn't dig into internals, I'm just speculating).
So, how the unrelated histories happen ?
Here are few scenarios, I can think.
- One personally
git initlocally, and done a fair amount of coding. Another person, created git repo just for the first person.
- If one person shares a project folder to other without initializing a git repo (ie.
git init). Then, both of them
git initat later stage.
Then, you might end-up in unrelated histories. Probably, you will see this error.
fatal: refusing to merge unrelated histories.
The option to fix this is
For example, see following command
git pull origin master --allow-unrelated-histories https://github/username/reponame.git
Say two developers are working on project and both are using git. They can merge git repos locally as well.
git pull /path/to/other-copy
Actually, other operations like
clone, pull, etc. work as well.