简体   繁体   中英

Hiding the .gitignore using VSCode's Files:Exclude

I am trying to hide my .gitignore file in the VSCode project file explorer.

If I use this expression:

**/.*

Then .git, among a few others, will become hidden.

But when I try this:

**/.gitignore

I am still unable to hide it. I also tried a few other things, like these:

**/.git*
**/*.git*
**/*.gitignore

I feel a little silly, sorry! Thanks for your time, I sincerely appreciate it. It seems like a little silly thing, but I want to know!

The format in Visual Studio should be

**/.git

You could also make a global git ignore on your computer like this:

Make a hidden file in terminal called “.gitignore_global”

$ open ~/.gitignore_global
$ git config --global core.excludesfile ~/.gitignore_global

You can then edit this file by using vim or nano. Dealer's choice :)

vim ~/.gitignore_global

or

nano ~/.gitignore_global

and add your gitignore stuff like this:

.gitignore
*.gitignore
**/.gitignore*

The pros of making a global file is you will only need to do it once. Here is some info I found on it: https://medium.com/self-modifying-code/create-a-global-gitignore-step-by-step-for-macos-and-windows-31a765291409

I hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM