I encountered a bug that made me lose tons of work (see this thread). I am new to git, but this is probably not a desired behavior, espacially that the manipulation I did is typically something you would do when you discover Git. I did it using Atom so I will describe the steps to reproduce it on Atom. However, I don’t think that’s related to Atom. Here is how to reproduce it:
Step 1. Create a new project in Atom (My Project)
Step 2. In the project create a folder (Folder 1)
Step 3. In that project create a source file (aFile.jl) and write “This is the file in folder 1” in it, save
Step 4. Duplicate Folder 1 twice, name the new folders Folder 2 and Folder 3 respectively.
Step 5. Change the text in Folder 2/aFile.jl to “This is the file in folder 2”, save. Do the same in folder 3 but with a 3.
Step 6. In the Git tab, initialize a new repository. Your project tree should now look like this:
> My Project
> Folder 1
> Folder 2
> Folder 3
Step 7. In the Git tab, the three files should be awaiting in unstaged changes. Click on the … next to it and _discard all changes. _If you now check the tree the “aFile.jl” files disapeared.
Step 8. In the Git tab, click on the same … and undo last discard. This will bring back the files.
However, if you check their contents, the “aFile.jl” files now have the same content. Which means that the undo pick a single file and wrote it in every folder. I know that Step 7. is stupid, but I did it thinking Git was “safe” for my files. This is not an expected behaviour. If this is not a bug and you know a way of restoring the three files in the state they were at Step 6. I would be eternally grateful for a solution. If it is a bug, then someone may want to fix that.