From dbcbf2787c61d6968bf75df998f8981627e9d5f2 Mon Sep 17 00:00:00 2001 From: Flancian <0@flancia.org> Date: Thu, 26 May 2022 18:57:20 +0200 Subject: [PATCH] Auto saved by Logseq --- ...ated histories.md.2022-05-26T16_56_55.764Z | 11 +++++++ refusing to merge unrelated histories.md | 29 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 logseq/bak/refusing to merge unrelated histories.md.2022-05-26T16_56_55.764Z diff --git a/logseq/bak/refusing to merge unrelated histories.md.2022-05-26T16_56_55.764Z b/logseq/bak/refusing to merge unrelated histories.md.2022-05-26T16_56_55.764Z new file mode 100644 index 000000000..e6b34818b --- /dev/null +++ b/logseq/bak/refusing to merge unrelated histories.md.2022-05-26T16_56_55.764Z @@ -0,0 +1,11 @@ +- an [[error]]. + - in [[git]] + - [[fatal]] + +I get this a lot when trying to merge repositories with different histories -- which of course shouldn't happen often, but does happen to me when I'm trying to [[bootstrap]] a new repository. + +Case in point: writing the README first when creating the repository in [[gitlab]] or [[github]] makes sense to me, as it's checking a checkbox and editing. And uploading a set of bootstrapping files then makes sense as a second step to me -- but that is ideally done right at the place files live, and once there it's easy to just say `git init`. But then if you want to merge the two you get into problems as [[git]] doesn't merge unrelated histories by default. + +- #go https://stackoverflow.com/questions/39761024/refusing-to-merge-unrelated-histories-failure-while-pulling-to-recovered-repos/39783462#39783462 + +This [[stack overflow]] answer contains the flag you need: `--allow-unrelated-histories`. I guess [[git]] doesn't include it in the error message to prevent people from just tacking it on without knowing what they are doing (just to make the error go away) and having a mess as a result. It only makes sense if not surprising: that is, if you are trying to merge two unrelated repositories. diff --git a/refusing to merge unrelated histories.md b/refusing to merge unrelated histories.md index e6b34818b..6c6490251 100644 --- a/refusing to merge unrelated histories.md +++ b/refusing to merge unrelated histories.md @@ -9,3 +9,32 @@ Case in point: writing the README first when creating the repository in [[gitlab - #go https://stackoverflow.com/questions/39761024/refusing-to-merge-unrelated-histories-failure-while-pulling-to-recovered-repos/39783462#39783462 This [[stack overflow]] answer contains the flag you need: `--allow-unrelated-histories`. I guess [[git]] doesn't include it in the error message to prevent people from just tacking it on without knowing what they are doing (just to make the error go away) and having a mess as a result. It only makes sense if not surprising: that is, if you are trying to merge two unrelated repositories. + +``` +flancian@paramita:~/.local/share/chezmoi$ git pull origin main --allow-unrelated-histories +From gitlab.com:flancian/flancian + * branch main -> FETCH_HEAD +hint: Pulling without specifying how to reconcile divergent branches is +hint: discouraged. You can squelch this message by running one of the following +hint: commands sometime before your next pull: +hint: +hint: git config pull.rebase false # merge (the default strategy) +hint: git config pull.rebase true # rebase +hint: git config pull.ff only # fast-forward only +hint: +hint: You can replace "git config" with "git config --global" to set a default +hint: preference for all repositories. You can also pass --rebase, --no-rebase, +hint: or --ff-only on the command line to override the configured default per +hint: invocation. +Merge made by the 'recursive' strategy. + README.md | 35 +++++++++++++++++++++++++++++++++++ + social/mastodon/README.md | 1 + + social/twitter/README.md | 1 + + social/twitter/apikey.asc | 21 +++++++++++++++++++++ + 4 files changed, 58 insertions(+) + create mode 100644 README.md + create mode 100644 social/mastodon/README.md + create mode 100644 social/twitter/README.md + create mode 100644 social/twitter/apikey.asc +flancian@paramita:~/.local/share/chezmoi$ +```