https://stackoverflow.com/questions/4250063/how-to-gitignore-all-files-folder-in-a-folder-but-not-the-folder-itself/5581995#5581995

 

put this .gitignore into the folder, then git add .gitignore

*
*/
!.gitignore

The * line tells git to ignore all files in the folder, but !.gitignore tells git to still include the .gitignore file. This way, your local repository and any other clones of the repository all get both the empty folder and the .gitignore it needs.

Edit: May be obvious but also add */ to the git ignore to also ignore sub folders.

相关文章:

  • 2021-12-12
  • 2021-06-23
  • 2022-12-23
  • 2021-10-18
  • 2022-01-29
  • 2021-10-21
  • 2021-07-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2021-12-27
  • 2021-06-14
相关资源
相似解决方案