3 ms·
Interesting, now I learned that a git repo can have any number of commits that have no parents. It can be achieved by fetching an unrelated repo and merging wit
by leni536 10y ago
Interesting, now I learned that a git repo can have any number of commits that have no parents. It can be achieved by fetching an unrelated repo and merging with --allow-unrelated-histories or by using git checkout --orphan.
> safety check
Why is this considered unsafe? Only to avoid pulling from unrelated repos by accident? The man says for --allow-unrelated histories:
> As that is a very rare occasion, no configuration variable to enable this by default exists and will not be added.
Well this is quite harsh, it looks like it's considered to be rather unsafe.
- geofft 10y agoYeah, I imagine it's unsafe because "git pull" implicitly creates a merge commit when it can't otherwise update, and your remote URL might now be pointing at a different history. Maybe github.com/someproject/somecode got replaced by a clean rewrite and you're actually looking for someproject/somecode-old. Maybe you were pointing at an unofficial git-svn import and now there's an official git migration. And so forth. (Personally, I think the right way to address this is for "git pull" not to implicitly create merge commits...)