In Git, you can use the gitignore
file to specify untracked files that Git should ignore.
Each line in a gitignore
file specifies a pattern.
In this shot, we will see how you can ignore an entire folder/directory.
Create a file called .gitignore
in your project’s directory. In case you already have it, skip this step.
To add a folder/directory to .gitignore
, include their paths and put a /
at the end:
folder_to_ignore/
Note: .gitignore ignores untracked files. Files already tracked by Git are not affected. To stop tracking a file that is currently tracked, use
git rm --cached
.