Set up a global .gitignore
file to avoid committing IDEs, editors and system files.
$ vim ~/.gitignore_global
Copy/Past the following lines:
# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
.vimrc
.nvimrc
# Visual Studio Code
.vscode/*
.history/*
# System files
.DS_Store
Thumbs.db
Note
|
To save in vim, press Esc to enter Command mode, and then type :wq to write and quit the file.
|
If I need to have a more refined strategy for Visual Studio Code, I can, for example, integrate the following block in the project .gitignore
file:
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
For Composer or Node, it is preferable to configure the .gitignore
file of the project, and not the global one, to avoid any other person to end up, at the cloning and at the first installation, with the vendor
or node_modules
folders marked by Git:
# Composer
vendor/
# Node
node_modules/
-
Collection of useful
.gitignore files
: https://github.com/github/gitignore -
Create useful
.gitignore
files for your project : https://www.gitignore.io/ -
https://github.com/angular/angular/blob/main/.gitignore