Home > Net >  Why 'git add *' doesn't track deleted files?
Why 'git add *' doesn't track deleted files?

Time:05-10

As shown in the picture, the git add * command does not track a .sh file whose name does not start with a dot. But if I specify the file in the git add command, it can track it. I wonder why this happens?

enter image description here

This post explains the differences between git add *, git add ., etc, but it doesn't explain my problem.

CodePudding user response:

What you want to do is git add --all.

The reason for git add * not working is that the shell will expand the * argument to a list of all the names of the files/folders in the current directory.

But because commit.sh does not exist, your shell with not see it.
Therefore deleted files will not be passed as arguments to git add when using the shell's * expansion.

  • Related