Keep your project .gitignore clean by configuring a global ignore file for system and editor-specific clutter.
When reviewing code, We may see commits like this in the .gitignore file:
composer.lock
package.lock
+ .vscode
Among them, .vscode is the configuration file of vscode. If everyone puts their own environment/editor configuration in .gitignore, the .gitignore file will be very long and difficult to maintain. To keep your project clean and tidy, we can use the global .gitignore
.gitignore.gitignore file in home path, which is usually a good choice for:touch ~/.gitignore.gitignore file and put the content that needs to be excluded globally, such as:.cache
.vscode
.DS_StoreTypically, you'll want to exclude the operating system's temporary files (like .DS_Store in Mac) and your editor's temporary configuration files (like Vscode's .vscode) files.
git config --global core.excludesfile ~/.gitignoreIn this way, we don't have to add these duplicate files to all projects in the future!
This post is just my perspective—your input will make it richer!