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

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

From
MTMarcel 'childNo͡.de' Trautwein <c0d3+gitscm@childno.de>
Date
Feb 22, 2018, 22:41 UTC
Message-ID
<741A56BF-93C0-41EA-856F-C1170803F0A7@childno.de>
Hi,

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“.

Because? It pruned a lot of files and even the local repository. by pull by giving another repository URL instead of a known remote

While working in a subpath of my homedir (that is a git repository itself, without any changes in worktree or index: https://bitbucket.org/childnode/marcel/ ) 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?
🙏 god any untracked / ignored files are still alive

a, yeh, I’m on a mac (for any git configuration … have a look in my repository https://bitbucket.org/childnode/marcel/src/88ff8d0c28bb90dfde3aea9e6c39bb551bea8ca8/.gitconfig?at=master&fileviewer=file-view-default

the console out was:
```
-bash:$ git pull git@private.gitlab.instance.example.com:aGroup/repository.git
Warning: Permanently added the ECDSA host key for IP address '10.1.2.3' to the list of known hosts.
warning: no common commits
remote: Counting objects: 2301, done.
remote: Compressing objects: 100% (710/710), done.
remote: Total 2301 (delta 1040), reused 2239 (delta 1004)
Receiving objects: 100% (2301/2301), 405.41 KiB | 635.00 KiB/s, done.
Resolving deltas: 100% (1040/1040), done.
From private.gitlab.instance.example.com:aGroup/repository
 * branch            HEAD       -> FETCH_HEAD
Fetching submodule .shapps/willgit
Fetching submodule .vim
Fetching submodule .vim/autoload/pathogen
warning: redirecting to https://github.com/tpope/vim-pathogen.git/
Fetching submodule .vim/bundle/ack
warning: redirecting to https://github.com/mileszs/ack.vim.git/
Fetching submodule .vim/bundle/colors-solarized
warning: redirecting to https://github.com/altercation/vim-colors-solarized.git/
Fetching submodule .vim/bundle/flake8
Fetching submodule .vim/bundle/fugitive
warning: redirecting to https://github.com/tpope/vim-fugitive.git/
Fetching submodule .vim/bundle/kwbdi
warning: redirecting to https://github.com/vim-scripts/kwbdi.vim.git/
Fetching submodule .vim/bundle/markdown
warning: redirecting to https://github.com/tpope/vim-markdown.git/
Fetching submodule .vim/bundle/nerdtree
warning: redirecting to https://github.com/scrooloose/nerdtree.git/
Fetching submodule .vim/bundle/unimpaired
warning: redirecting to https://github.com/tpope/vim-unimpaired.git/
Fetching submodule gists/bitbucket/childnode/2015-06-16_G4pLy_prevent-empty-version-comment-in.git
Fetching submodule gists/bitbucket/childnode/2015-06-21_kyAAM_plasticscm-addcurrentworkdir-batch-task
Fetching submodule gists/github/childnode/18de20f4448692257aa3e99c8319b70d
Fetching submodule gists/github/childnode/295dbd6e_hasSize.regex
Fetching submodule gists/github/childnode/4a0de936_gradle_buildSrc_dogfood
Fetching submodule gists/github/childnode/66d4b982_git.rebaseAllBranches
Fetching submodule gists/github/childnode/6df6d14c_ideaGradleProjectSetupForAdditionalSourceSets
Fetching submodule gists/github/childnode/81ae6468_build_jar_manifest.gradle
Fetching submodule gists/github/childnode/85958ff8_extendedHelp.gradle_secret
Fetching submodule gists/github/childnode/88304258_git_deleteAllRemoteBranches.sh
Fetching submodule gists/github/childnode/8f100f90_dockerSaveAllImages.sh
Fetching submodule gists/github/childnode/9741c4d1_idea.warnGenerateWorkspace.gradle_secret
Fetching submodule gists/github/childnode/a175d954_ext.props.gradle_secret
Fetching submodule gists/github/childnode/d15cd5e9_atlassian-confluence-config
Fetching submodule gists/github/childnode/d35cf810dd28775ac5c0e491107215fd
Fetching submodule gists/github/childnode/da08e8a6f989ce0f94077ae1a6b1573b
Fetching submodule gists/github/childnode/e7ef876c_html2ical_secret
Fetching submodule gists/github/childnode/eb3199790f2f82785f62c3150f352ede
Successfully rebased and updated refs/heads/master.
```

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

-bash:$ git pull git@bitbucket.org:childnode/marcel.git
From bitbucket.org:childnode/marcel
 * branch            HEAD       -> FETCH_HEAD
fatal: refusing to merge unrelated histories
```

these messages and the fact that it doesn’t work backward let me think I ran into a collision? really?

revlog looks a bit strange too ``` 04f3066 (HEAD -> master) HEAD@{0}: pull git@private.gitlab.instance.example.com:aGroup/repository.git: checkout 04f3066d03e09323c7341c472be4c45ea5e3a4ff: returning to refs/heads/master 04f3066 (HEAD -> master) HEAD@{1}: pull git@private.gitlab.instance.example.com:aGroup/repository.git: checkout 04f3066d03e09323c7341c472be4c45ea5e3a4ff 88ff8d0 (origin/master, origin/HEAD) HEAD@{2}: pull --rebase=preserve: checkout 88ff8d0c28bb90dfde3aea9e6c39bb551bea8ca8: returning to refs/heads/master ```

where 88ff8d0 was the latest from marcel.git and logs look like the pulled repository is like an orphan aside my original one.

~Marcel
P.S: I reverted by `$ git reset 88ff8d0 && git checkout -- .`
Next: Jonathan Nieder
Message 1 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.