简体   繁体   English

使用 VSCode 的 Files:Exclude 隐藏 .gitignore

[英]Hiding the .gitignore using VSCode's Files:Exclude

I am trying to hide my .gitignore file in the VSCode project file explorer.我试图在 VSCode 项目文件资源管理器中隐藏我的 .gitignore 文件。

If I use this expression:如果我使用这个表达式:

**/.*

Then .git, among a few others, will become hidden.然后 .git 以及其他一些文件将被隐藏。

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 Visual Studio 中的格式应该是

**/.git

You could also make a global git ignore on your computer like this:您还可以像这样在您的计算机上进行全局 git 忽略:

Make a hidden file in terminal called “.gitignore_global”在终端中创建一个名为“.gitignore_global”的隐藏文件

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

You can then edit this file by using vim or nano.然后,您可以使用 vim 或 nano 编辑此文件。 Dealer's choice :)经销商的选择:)

vim ~/.gitignore_global

or或者

nano ~/.gitignore_global

and add your gitignore stuff like this:并像这样添加你的 gitignore 东西:

.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这是我在上面找到的一些信息: https ://medium.com/self-modifying-code/create-a-global-gitignore-step-by-step-for-macos-and-windows-31a765291409

I hope this helps!我希望这有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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