Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 41 of 49

Re: How to deal with "refusing to merge unrelated histories" error

Worked perfectly in VS Code

Ground Controller Lvl 1
Message 42 of 49

Re: How to deal with "refusing to merge unrelated histories" error

if you already did a pull and you came up with master and origin/master but can't merge them, the following command can help you:

 

 

git merge origin/master --allow-unrelated-histories 

 

Ground Controller Lvl 1
Message 43 of 49

Re: How to deal with "refusing to merge unrelated histories" error

its working thanks man 

Ground Controller Lvl 2
Message 44 of 49

Re: How to deal with "refusing to merge unrelated histories" error

Yeah, it worked for me.

Ground Controller Lvl 2
Message 45 of 49

Re: How to deal with "refusing to merge unrelated histories" error

Its not working when I run the command on git bash.

$ git pull --allow-unrelated-histories
Result:  fatal: not a git repository (or any of the parent directories): .git

Ground Controller Lvl 1
Message 46 of 49

Re: How to deal with "refusing to merge unrelated histories" error

Someone please make this answer show up at the top of the thread lol! It fixed the problem for me and the current top positioned comment is completely the incorrect practice for solving the issue. Thanks again for correct pull to stop the unrelated histories error.

Ground Controller Lvl 1
Message 47 of 49

Re: How to deal with "refusing to merge unrelated histories" error

 I was also facing the same problem. But I realised I was trying to push my one git project material on other remote git project. Solution:

Clone the fresh project again and this time make sure cloning link is starting from ssh if you have added the SSH key and https:// if you have added the puttyKey.

Ground Controller Lvl 1
Message 48 of 49

Re: How to deal with "refusing to merge unrelated histories" error

Managed by avoiding creating the repository with a Readme.

 

1. crete without readme.md

2. the 'create-react-app' command already have a 'Readme.md' file.

3. Modify teh readme.md later on.

 

Thanks,

Arun

Ground Controller Lvl 1
Message 49 of 49

Re: How to deal with "refusing to merge unrelated histories" error

Well you can try and do 

# make the local repository recognize the remote

git remote add orign <giturl>

git branch --set-upstream-to=origin/master 

#sync the branches

git rebase

# if any conflict resolve and continue

# push to remote

git push