Local and Personal Git Ignore Rules (.gitignore)
Local Git Ignore Rules
There will one .gitignore file in the local repository in this file and all the files and the directories which should be ignored are mentioned and it will be shared with the others unless you commit and push it to the remote repository. It applicable only to single and particular repository where the file to be ignored.
Personal Git Ignore Rules
You can set up an .gitignore file which can be applied to the all the git repositories. It will not shared with any other collaborators.
Steps To Create a global .gitignore file
Step 1: Create .gitignore file as following.
touch ~/.gitignore_global
Step 2: Add the required rules to the .gitignore file as shown below.
# ~/.gitignore_global
*.swp
.DS_Store
Step 3: Know we need to make this file as an golbal .gitignore file.
git config --global core.excludesfile ~/.gitignore_global
What is Git-Ignore and How to Use it?
There are various types of files we might want the git to ignore before committing, for example, the files that are to do with our user settings or any utility setting, private files like passwords and API keys. These files are not of any use to anyone else and we do not want to clutter our git. We can do this with the help of “