git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] [git 2.16.1] yeeek ... my files are gone .. by git pull <otherRepositoryUrl>

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Feb 22, 2018, 23:20 UTC
Message-ID
<20180222232031.GE256918@aiede.svl.corp.google.com>
In-Reply-To
<741A56BF-93C0-41EA-856F-C1170803F0A7@childno.de>
Hi Marcel,
Marcel 'childNo͡.de' Trautwein" wrote:
> I think we have a problem … or at least I had
> and I’m not quite sure if this is „working as designed“
> but I’m sure it „should not work as it did“.
[...]
Show 7 quoted lines
> I wanted to clone another repository … but yeah … it’s late for me today and I put
> in s.th. `git pull git@private.gitlab.instance.example.com:aGroup/repository.git`
>
> next … all committed files are zapped and the repository given has
> been checked out in my home directory 🤯👻
>
> what? Shouldn’t this just fail? Why can I pass another remote to pull?
Sorry, this is not the most helpful reply but:

Can you describe a reproduction recipe so that I can experience the same thing?

That is:
 1. steps to reproduce
 2. expected result
 3. actual result
 4. the difference and why it was unexpected

I suspect that this information is in your message, somewhere, but it is (understandably) unfocussed and I am having trouble pulling it out.

[...]
Show 8 quoted lines
> trying to fix this up by doing another pull failed:
> ```
> -bash:$ git remote -v
> origin	git@bitbucket.org:childnode/marcel.git (fetch)
> origin	git@bitbucket.org:childnode/marcel.git (push)
>
> -bash:$ git pull
> fatal: refusing to merge unrelated histories
Ok, this part is something I might be able to help shed some light on.
Searching for 'unrelated' in "git help pull" finds:
       --allow-unrelated-histories
	   By default, git merge command refuses to merge histories that do not
	   share a common ancestor. This option can be used to override this
	   safety when merging histories of two projects that started their
	   lives independently. As that is a very rare occasion, no
	   configuration variable to enable this by default exists and will not
	   be added.
So that explains the "what" of that error message.
The "why" is a separate question.  Could you share output from
  git log --all --graph --decorate --oneline --simplify-by-decoration
and
  git status
to help us understand your current state?

Also, suggestions for improvements to the 'refusing to merge' message would be very welcome.

Thanks and hope that helps, Jonathan

Previous: Marcel 'childNo͡.de' TrautweinNext: Marcel 'childNo͡.de' Trautwein
Message 2 of 8 in “[BUG] [git 2.16.1] yeeek ... my files are gone .. by git pull <otherRepositoryUrl>”
  1. Marcel 'childNo͡.de' TrautweinFeb 22, 2018
  2. Jonathan NiederFeb 22, 2018
  3. Marcel 'childNo͡.de' TrautweinFeb 23, 2018
  4. Jeff KingFeb 23, 2018
  5. Johannes SchindelinFeb 26, 2018
  6. Jeff KingFeb 28, 2018
  7. Johannes SchindelinMar 5, 2018
  8. Jeff KingMar 5, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.