0

In the root of my (versioned) project I create a folder with a .sh file inside and a README file. Then with the command git status the output (correctly) was that I've to git add the new files.

I don't git add the files but I added them to .gitignore file. After that, with git status the output was that I have to git add the modified .gitignore.

Then I print git add . and git commit commands. Now my two initial files are not present and I can't understand why.

With adding files in .gitignore I thought that the files were present but the changes were not tracked but not that they disappeared.

Did I get it wrong or did I make some mistakes? What happened to those files?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
richi
  • 1
  • 4
  • 2
    did the files disappear from `git status` or from the filesystem (e.g. `ls` or `dir`)? adding a file to `.gitignore` causes git to not care about them, but they should still be present in the filesystem. – Edward Aug 04 '21 at 22:22
  • files disappeared in the filesystem – richi Aug 04 '21 at 23:00
  • You must have done something else as well, as nothing you lists here would delete any files. Have you checked your Trash Can/Recycle Bin? – TheIceBear Aug 04 '21 at 23:23
  • https://stackoverflow.com/search?q=%5Bgitignore%5D+what+is – phd Aug 04 '21 at 23:35
  • Thanks, ok so you confirmed to me that gitignore works as I intended and it's the most important thing. I did some tests and now it seems to work as expected. But I checked now and those file aren't in trash, I'm sure I created those files in the same commit because they were marked in the .gitignore so I didn't confuse commit. Anyway I must have done something else wrong. – richi Aug 05 '21 at 00:24

0 Answers0