![]() I tried: git pull origin master -allow-unrelated-historiesĬONFLICT (add/add): Merge conflict in README.mdįix conflicts and then commit the result. Now to overcome this I did git pull origin masterįatal: refusing to merge unrelated histories** Hint: See the 'Note about fast-forwards' in 'git push -help' for details. Hint: Updates were rejected because the tip of your current branch is behind I got: error: failed to push some refs to '' So now when I ran git push -set-upstream origin master Here I made a mistake of checking "Initialize this repository with a README", which created a README.md in remote too. Then I wanted a remote repository so I created one on GitHub. I added a LICENSE and README.md file to my local and committed. The problem is remote had something preventing this. Successfully rebased and updated refs/heads/test-branch. Find out the parent commits of the original merge commit: $ git log -1 1234deadbeef1234deadbeefįind out which of the two merge parents is the one that was merged into the current one (probably the second one, verify with git log 222222222), and then do the merge by hand, copying the commit message of the original merge commit: $ git merge -allow-unrelated 222222222 -no-commitĪutomatic merge went well stopped before committing as requested Pick 1234deadbeef1234deadbeef test merge commit ![]() Interactive rebase in progress onto 4321beefdead This error doesn't actually cancel the rebase, but you are now in the middle of it: $ git status So you get your error doing git rebase: $ git rebase origin/developmentįatal: refusing to merge unrelated historiesĮrror redoing merge 1234deadbeef1234deadbeef Since all the other answers are not actually answering the question, here is a solution inspired by this answer on a related question. Git failed with a fatal error, refusing to merge unrelated histories with Git push.This user uses GitHub Desktop: How can I fix "refusing to merge unrelated histories" when uploading a project to GitHub?.Git is refusing to merge unrelated histories.If -allow-unrelated-histories don't work: "fatal: refusing to merge unrelated histories" after adding a Git remote.Recommended A great explanation and warning on using -allow-unrelated-histories: ”refusing to merge unrelated histories” failure while pulling to recovered repository.Recommended: “The “fatal: refusing to merge unrelated histories” Git error.As that is a very rare occasion, no configuration variable to enable this by default exists and will not be added. This option can be used to override this safety when merging histories of two projects that started their lives independently. The get-merge command (from Git documentation): -allow-unrelated-histories:īy default, git merge command refuses to merge histories that do not share a common ancestor. The “fatal: refusing to merge unrelated histories” Git error occurs when two unrelated projects are merged (i.e., projects that are not aware of each other’s existence and have mismatching commit histories). If it opens the nano editor you can just save and close with Ctrl + X. Git pull origin main -allow-unrelated-histories Git pull origin master -allow-unrelated-histories ![]() Run one of the below commands # It could be master Following the error when doing a git pull origin master: fatal: refusing to merge unrelated histories
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |