Why does git delete ignored files under `directory / *`, but not under `directory /`

As mentioned in this post

In other words, if in your .gitignore:

there is the following:
/my-ignored-directory/*

Then youre screwed up - after saving the git save -u, my-ignored-file.txt (and sorry, its not that you just created or). Upload recovery packages and hope for the best. Alternatively, if your .gitignore has the following:

/my-ignored-directory

Then youre golden - don’t worry, sit back, relax, my-ignored-file.txt will be exactly where it was before saving the git -u save.

Why is this a difference? I am also wondering if the files will be deleted if .gitignoreI have in my file /my-ignored-directory/(with a trailing slash)?

+4
1

, . , :

-include-untracked, , git clean, . -all, .

Git Git clean -d, .

, :

git stash --include-untracked --all 
+2

All Articles