gitignore FIle
.gitignore forces files to be untracked. Files that we do not want to share are described inside .gitignore.
Place the .gitignore file in your root directory.
Examples
ignore.txt→ Ignore theignore.txtfile*.txt→ Ignore all files with the.txtextensiontemp/→ Ignore thetempfolder!main.txt→ Do not ignoremain.txt(exception rule)ignore?.txt→ Ignore files likeignore1.txt,ignore2.txt,ignoreA.txt(matches exactly one character afterignore)ignore????.txt→ Ignore files starting withignorefollowed by exactly 5 charactersignore*.txt→ Ignore all files starting withignore
Notes
git statusdisplays the working directory and staging area (tracked and untracked files).- You can check whether
.gitignoreis working usinggit status. - If it's working, some files will appear as untracked.
- When creating a new repository, there is an option to add a
.gitignorefile. - You can select a
.gitignoretemplate based on your application (e.g., Node, Android, etc.).