Yes, you can ignore multiple directories in a Git repository by listing each directory in the .gitignore file. Here’s how to do it:
Create or open the
.gitignorefile in the root of your repository.Add each directory you want to ignore, one per line. For example:
logs/ temp/ build/In this example, the directories
logs,temp, andbuildwill all be ignored.Save the
.gitignorefile.
Important Notes:
If any of the directories you want to ignore are already tracked by Git, you will need to untrack them first using:
git rm -r --cached directory_name/After updating the
.gitignorefile, you can commit the changes:git add .gitignore git commit -m "Update .gitignore to ignore multiple directories"
This will ensure that the specified directories and their contents are ignored in future commits.
