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

Re: Bug: Pulling remotes into an empty repo deletes the index

From
AAAdam A <hitsthings@gmail.com>
Date
Aug 3, 2013, 12:01 UTC
Message-ID
<CAJOTJ-Cgdg4CQs-3t1CsBkq_feVEpkoASzQSTATiVugjs+LL7w@mail.gmail.com>
In-Reply-To
<CAJOTJ-AVamimToPo4oQ=O_Pg+mJHQhardO+NfU8b1dvRxg1KMA@mail.gmail.com>

Hello, the project readme on github points here for submitting bug reports, but please let me know if I'm in the wrong place.

Steps to reproduce:
- create a remote repository at URL with commit(s) in it
  - e.g., a new github repo with README and LICENSE files auto-added
- write some files in a local directory
- git init
- git add .
  - the contents of the directory are now in the index
- git remote add origin URL
- git pull origin master

The local files added to the index are now completely wiped out and replaced with the remote content. I lose all my previous work. :/

This was pretty painful for me to lose a few days of work. I also couldn't stash my changes which I tried first, but git refused without an initial commit.

Would have been nice if git warning me about the destructive operation.

Cheers, Adam

On Sat, Aug 3, 2013 at 9:57 PM, Adam A <hitsthings@gmail.com> wrote:
Show 25 quoted lines
> Hello, the project readme on github points here for submitting bug reports,
> but please let me know if I'm in the wrong place.
>
> Steps to reproduce:
>
> - create a remote repository at URL with commit(s) in it
>   - e.g., a new github repo with README and LICENSE files auto-added
> - write some files in a local directory
> - git init
> - git add .
>   - the contents of the directory are now in the index
> - git remote add origin URL
> - git pull origin master
>
> The local files added to the index are now completely wiped out and replaced
> with the remote content. I lose all my previous work. :/
>
> This was pretty painful for me to lose a few days of work. I also couldn't
> stash my changes which I tried first, but git refused without an initial
> commit.
>
> Would have been nice if git warning me about the destructive operation.
>
> Cheers,
> Adam
Next: Daniel Convissor
Message 1 of 7 in “Re: Bug: Pulling remotes into an empty repo deletes the index”
  1. Adam AAug 3, 2013
  2. Daniel ConvissorAug 3, 2013
  3. Jonathan NiederAug 3, 2013
  4. Daniel ConvissorAug 3, 2013
  5. Adam AAug 3, 2013
  6. Jeff KingAug 10, 2013
  7. Daniel ConvissorAug 3, 2013

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.