Ignoring files in subfolders, multiple .gitignore files
suggest changeSuppose you have a repository structure like this:
examples/
output.log
src/
<files not shown>
output.log
README.md
output.log in examples/ is meant to stay in the project. The one under src/ is created while debugging and should not be committed.
There are two ways to ignore the file under src/. You can put a path relative to the repository root in the root .gitignore:
# /.gitignore
src/output.log
Alternatively, you can create a .gitignore file in the src/ directory and ignore the file that is relative to this .gitignore:
# /src/.gitignore
output.log
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents