I am trying to use the .gitignore
to help me filter out folders. I need an inner-folder but not anything else in the folder which contains this inner-folder.
I tried this:
.gitignore
**/outer-folder
!inner-folder/
This does not seem to work. The entire outer-folder is gone. Why?
Also, I would appreciate if someone help me with a relevant question: Maybe the reason this does not work is because the .gitignore
never get re-executed after I added these two lines of code. So how to force Git run .gitignore
?
I tried touch .gitignore
but some bash (e.g. vscode) does not know command touch
. Any better solution?