Git switch branch content still exists

1. Create a branch and a folder under branch a, and make changes. Then, submit it to the warehouse.
2. Then switch to the b branch. Use git status. Prompt me to add (only folders exist, no specific files exist).
what is the reason for this? How to deal with it?

Git
Mar.24,2021

your folder is empty. Git will not find that a new empty folder has been created, so git will automatically ignore the empty folder.
solution to submitting empty folders:

in this case, you only need to create a .gitkeep file in the directory, and then set not to ignore .gitkeep
.gitkeep in the project's .gitignore. Gitkeep is a conventional file name with no special rules

.
Menu