{"componentChunkName":"component---src-templates-blog-post-template-js","path":"/2017/06/30/git-allow-unrelated-histories/","result":{"data":{"mdx":{"id":"0ead006c-347e-5884-ae54-8c2ada5bed30","frontmatter":{"title":"Git ` — allow-unrelated-histories`","date":"2017 June 30th","cover":{"id":"84aec54d-601f-5b33-a1d3-7fdbaf6c2eba","publicURL":"/static/cover-3542ce7081e6a71aa1242289a389d5fc.jpg"}},"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"date\": \"2017-06-30T00:00:00.000Z\",\n  \"title\": \"Git ` — allow-unrelated-histories`\",\n  \"tags\": [\"information\", \"guide\"],\n  \"published\": true,\n  \"cover\": \"./cover.jpg\",\n  \"coverCredit\": \"Photo by timJ on Unsplash\"\n};\n\nvar makeShortcode = function makeShortcode(name) {\n  return function MDXDefaultShortcode(props) {\n    console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n    return mdx(\"div\", props);\n  };\n};\n\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, [\"components\"]);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"How to combine two separate unrelated Git repositories into one with\\nsingle history timeline.\"), mdx(\"p\", null, \"Just adding a quick note on this\\u2026\"), mdx(\"p\", null, \"I had a project that started off as it\\u2019s own project but it ended up\\nneeding to go into an already existing project, so I thought ok add it\\nas a new branch on the existing project with \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"git remote add origin\"), \"\\nthen push the changes up to the origin then all is well with the\\nworld. That was until I tried to compare the branches\\u2026\"), mdx(\"p\", null, mdx(\"span\", _extends({\n    parentName: \"p\"\n  }, {\n    \"className\": \"gatsby-resp-image-wrapper\",\n    \"style\": {\n      \"position\": \"relative\",\n      \"display\": \"block\",\n      \"marginLeft\": \"auto\",\n      \"marginRight\": \"auto\",\n      \"maxWidth\": \"640px\"\n    }\n  }), \"\\n      \", mdx(\"a\", _extends({\n    parentName: \"span\"\n  }, {\n    \"className\": \"gatsby-resp-image-link\",\n    \"href\": \"/static/5602c54638703c110ed8325946dd4e07/20c85/git-compare.png\",\n    \"style\": {\n      \"display\": \"block\"\n    },\n    \"target\": \"_blank\",\n    \"rel\": [\"noopener\"]\n  }), \"\\n    \", mdx(\"span\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-background-image\",\n    \"style\": {\n      \"paddingBottom\": \"20.62062062062062%\",\n      \"position\": \"relative\",\n      \"bottom\": \"0\",\n      \"left\": \"0\",\n      \"backgroundImage\": \"url('data:image/svg+xml,%3csvg%20xmlns=\\\\'http://www.w3.org/2000/svg\\\\'%20width=\\\\'400\\\\'%20height=\\\\'82\\\\'%3e%3cpath%20d=\\\\'M198%2045l-1%201c-1-1-3%200-3%201h-2l-3-1c-2%200-3%200-3%202s0%202%201%201h2c1%201%201%201%201-1%201-1%201%200%201%201v3c1%200%202-1%202-3%201-2%202-2%202-1l2%202%202-2h1c0%201%201%202%203%202s3-1%203-2h1l2%202c1%200%202%200%201%201v1c1%202%203%200%203-3v-3h-7l-7-1h-1\\\\'%20fill=\\\\'%23d3d3d3\\\\'%20fill-rule=\\\\'evenodd\\\\'/%3e%3c/svg%3e')\",\n      \"backgroundSize\": \"cover\",\n      \"display\": \"block\"\n    }\n  })), \"\\n  \", mdx(\"picture\", {\n    parentName: \"a\"\n  }, \"\\n        \", mdx(\"source\", _extends({\n    parentName: \"picture\"\n  }, {\n    \"srcSet\": [\"/static/5602c54638703c110ed8325946dd4e07/60a22/git-compare.webp 160w\", \"/static/5602c54638703c110ed8325946dd4e07/4c812/git-compare.webp 320w\", \"/static/5602c54638703c110ed8325946dd4e07/0ba47/git-compare.webp 640w\", \"/static/5602c54638703c110ed8325946dd4e07/e46b2/git-compare.webp 960w\", \"/static/5602c54638703c110ed8325946dd4e07/5375e/git-compare.webp 999w\"],\n    \"sizes\": \"(max-width: 640px) 100vw, 640px\",\n    \"type\": \"image/webp\"\n  })), \"\\n        \", mdx(\"source\", _extends({\n    parentName: \"picture\"\n  }, {\n    \"srcSet\": [\"/static/5602c54638703c110ed8325946dd4e07/69538/git-compare.png 160w\", \"/static/5602c54638703c110ed8325946dd4e07/72799/git-compare.png 320w\", \"/static/5602c54638703c110ed8325946dd4e07/6af66/git-compare.png 640w\", \"/static/5602c54638703c110ed8325946dd4e07/d9199/git-compare.png 960w\", \"/static/5602c54638703c110ed8325946dd4e07/20c85/git-compare.png 999w\"],\n    \"sizes\": \"(max-width: 640px) 100vw, 640px\",\n    \"type\": \"image/png\"\n  })), \"\\n        \", mdx(\"img\", _extends({\n    parentName: \"picture\"\n  }, {\n    \"className\": \"gatsby-resp-image-image\",\n    \"src\": \"/static/5602c54638703c110ed8325946dd4e07/6af66/git-compare.png\",\n    \"alt\": \"compare\",\n    \"title\": \"compare\",\n    \"loading\": \"lazy\",\n    \"style\": {\n      \"width\": \"100%\",\n      \"height\": \"100%\",\n      \"margin\": \"0\",\n      \"verticalAlign\": \"middle\",\n      \"position\": \"absolute\",\n      \"top\": \"0\",\n      \"left\": \"0\"\n    }\n  })), \"\\n      \"), \"\\n  \"), \"\\n    \")), mdx(\"p\", null, \"There isn\\u2019t anything to compare? Bit misleading there as there is but\\nthe commit histories are different. How do you get around it, well the\\nfirst Google result was a bit sparse with the details but then I found\\nthis which was more helpful. I needed to merge the disparate branches\\nwhich is now disabled by default in git but can be enabled with the\\n\\u2014allow-unrelated-histories flag.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-bash\"\n  }), \"git merge origin use-ts-bot --allow-unrelated-histories\\n\")), mdx(\"p\", null, \"This brought up, understandably, a few conflicts with the branch I\\nwanted to merge with the origin.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-bash\"\n  }), \"Auto-merging package.json\\nCONFLICT (add/add): Merge conflict in package.json\\nAuto-merging package-lock.json\\nCONFLICT (add/add): Merge conflict in package-lock.json\\nAuto-merging README.md\\nCONFLICT (add/add): Merge conflict in README.md\\nAuto-merging .gitignore\\nCONFLICT (add/add): Merge conflict in .gitignore\\nAutomatic merge failed; fix conflicts and then commit the result.\\n\")), mdx(\"p\", null, \"To get around this I just took the latest version of the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"use-ts-bot\"), \"\\nbranch from my GitHub account and then and used that in place of the\\n\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"origin\"), \" conflicts as what I\\u2019m working on will ultimately replace the\\nmaster branch, so it was just a copy pasta into my VSCode then\\nrecommit the changes files. Phew! I now have a branch I can compare\\nwith the master that I will one day make a PR for \\uD83D\\uDE05\"), mdx(\"p\", null, mdx(\"span\", _extends({\n    parentName: \"p\"\n  }, {\n    \"className\": \"gatsby-resp-image-wrapper\",\n    \"style\": {\n      \"position\": \"relative\",\n      \"display\": \"block\",\n      \"marginLeft\": \"auto\",\n      \"marginRight\": \"auto\",\n      \"maxWidth\": \"640px\"\n    }\n  }), \"\\n      \", mdx(\"a\", _extends({\n    parentName: \"span\"\n  }, {\n    \"className\": \"gatsby-resp-image-link\",\n    \"href\": \"/static/8e5004783656e0f79dadb8b730fc43ae/75609/git-compare-after.png\",\n    \"style\": {\n      \"display\": \"block\"\n    },\n    \"target\": \"_blank\",\n    \"rel\": [\"noopener\"]\n  }), \"\\n    \", mdx(\"span\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-background-image\",\n    \"style\": {\n      \"paddingBottom\": \"74.04426559356136%\",\n      \"position\": \"relative\",\n      \"bottom\": \"0\",\n      \"left\": \"0\",\n      \"backgroundImage\": \"url('data:image/svg+xml,%3csvg%20xmlns=\\\\'http://www.w3.org/2000/svg\\\\'%20width=\\\\'400\\\\'%20height=\\\\'296\\\\'%3e%3cpath%20d=\\\\'M9%2036v7l1%206h65V36l-33-1-33%201m345%20254v5h25v-11h-25v6m1%200v4h23v-9h-23v5\\\\'%20fill=\\\\'%23d3d3d3\\\\'%20fill-rule=\\\\'evenodd\\\\'/%3e%3c/svg%3e')\",\n      \"backgroundSize\": \"cover\",\n      \"display\": \"block\"\n    }\n  })), \"\\n  \", mdx(\"picture\", {\n    parentName: \"a\"\n  }, \"\\n        \", mdx(\"source\", _extends({\n    parentName: \"picture\"\n  }, {\n    \"srcSet\": [\"/static/8e5004783656e0f79dadb8b730fc43ae/60a22/git-compare-after.webp 160w\", \"/static/8e5004783656e0f79dadb8b730fc43ae/4c812/git-compare-after.webp 320w\", \"/static/8e5004783656e0f79dadb8b730fc43ae/0ba47/git-compare-after.webp 640w\", \"/static/8e5004783656e0f79dadb8b730fc43ae/e46b2/git-compare-after.webp 960w\", \"/static/8e5004783656e0f79dadb8b730fc43ae/fd213/git-compare-after.webp 994w\"],\n    \"sizes\": \"(max-width: 640px) 100vw, 640px\",\n    \"type\": \"image/webp\"\n  })), \"\\n        \", mdx(\"source\", _extends({\n    parentName: \"picture\"\n  }, {\n    \"srcSet\": [\"/static/8e5004783656e0f79dadb8b730fc43ae/69538/git-compare-after.png 160w\", \"/static/8e5004783656e0f79dadb8b730fc43ae/72799/git-compare-after.png 320w\", \"/static/8e5004783656e0f79dadb8b730fc43ae/6af66/git-compare-after.png 640w\", \"/static/8e5004783656e0f79dadb8b730fc43ae/d9199/git-compare-after.png 960w\", \"/static/8e5004783656e0f79dadb8b730fc43ae/75609/git-compare-after.png 994w\"],\n    \"sizes\": \"(max-width: 640px) 100vw, 640px\",\n    \"type\": \"image/png\"\n  })), \"\\n        \", mdx(\"img\", _extends({\n    parentName: \"picture\"\n  }, {\n    \"className\": \"gatsby-resp-image-image\",\n    \"src\": \"/static/8e5004783656e0f79dadb8b730fc43ae/6af66/git-compare-after.png\",\n    \"alt\": \"git compare after\",\n    \"title\": \"git compare after\",\n    \"loading\": \"lazy\",\n    \"style\": {\n      \"width\": \"100%\",\n      \"height\": \"100%\",\n      \"margin\": \"0\",\n      \"verticalAlign\": \"middle\",\n      \"position\": \"absolute\",\n      \"top\": \"0\",\n      \"left\": \"0\"\n    }\n  })), \"\\n      \"), \"\\n  \"), \"\\n    \")));\n}\n;\nMDXContent.isMDXComponent = true;","excerpt":"How to combine two separate unrelated Git repositories into one with\nsingle history timeline. Just adding a quick note on this… I had a…","tableOfContents":{},"timeToRead":1,"fields":{"slug":"/2017/06/30/git-allow-unrelated-histories/","editLink":"https://github.com/spences10/thelocalhost.blog/edit/authoring/posts/2017/06/30/git-allow-unrelated-histories/index.md"}}},"pageContext":{"slug":"/2017/06/30/git-allow-unrelated-histories/","previous":{"id":"b4981904-af5f-57a8-bdc0-11ed861b5837","excerpt":"Speed up your git workflow with git aliases, this is a brief\nintroduction on using aliases 👌🚀👍 The more you work with Git the more familiar you become with the\ncommands used in your every day workflow for your projects or your\nteam's projects…","frontmatter":{"title":"Moving from beginner to (slightly more) advanced git with aliases.","date":"2017-06-01T00:00:00.000Z"},"fields":{"slug":"/2017/06/01/beginner-to-git-aliases/"}},"next":{"id":"fd6eb1dc-2ac9-5b7d-8568-ac08adf20762","excerpt":"I'm a Windows user, I have been a Linux user as well but I have found\nthat Windows is a bit less  neckbeardy  for me, both\nhave their pros and cons. One of the big cons with Windows for me was\nwhen I started learning web development. That was until…","frontmatter":{"title":"Windows Subsystem Linux setup","date":"2018-01-13T00:00:00.000Z"},"fields":{"slug":"/2018/01/13/wsl-bootstrap/"}}}}}