I need your help: I'm currently working on a web project with another person. I'm using NetBeans to develop the code, while he's using Dreamweaver. We would like to ignore all Dreamweaver _notes directories (these directories contain files produced by Dreamweaver itself). We don't know the exact path of these directories. We can find them at /a/b/c/_notes/f
or maybe at /_notes/a/b/c
or in tens other places. We tried to add
/_notes/
/nbproject
configs/
and
/_notes
/nbproject
configs/
and also
*_notes*
/nbproject
configs/
to the .gitignore file, but the _notes directories are still tracked. Any suggestions? Thank you in advance!
A . gitignore file is a plain text file that contains a list of all the specified files and folders from the project that Git should ignore and not track. Inside . gitignore , you can tell Git to ignore only a single file or a single folder by mentioning the name or pattern of that specific file or folder.
gitignore file is usually placed in the repository's root directory. However, you can create multiple . gitignore files in different subdirectories in your repository.
gitignore file is a plain text file where each line contains a pattern for files/directories to ignore. Generally, this is placed in the root folder of the repository, and that's what I recommend. However, you can put it in any folder in the repository and you can also have multiple . gitignore files.
The correct answer is
_notes/
That is, ignore all things named _notes
that are directories (hence the trailing slash).
edit: I have just seen that you say that directories are still tracked. You cannot ignore something that is already tracked, so what you must do is remove those directories from the index first, and then add the correct line to .gitignore
.
To delete the files from git, but not from the filesystem, use:
git rm -r --cached path/to/_notes
If you wish to remove those files from the filesystem too, just drop the --cached
option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With