Below is my directory structure.
parent_directory
|--.gitignore
|--static/
| |--js/
| | |--encoding.js
| |--css
| |--parent.css
|--tools/
| |--static/
| | |--js/
| | |--css/
| |--templates/
I want to ignore outer static directory. I tries static/**/
, static/
, static/**
but nothing is working. Whenever I edit encoding.js
file it appears in tracked file list.
Steps I followed - 1. Edited the .gitignore file and added pattern [all three one at a time]
2. Edited the file encoding.js
3. checked git status. File appeared in tracked file zone.
How should I add the pattern so that any folder or file in ./static/
folder is not tracked.
Update 1: Added static in the .gitignore file. Still not working. See the attached image. [ Solved ]
Update 2: adding static in .gitignore file ignores the /tools/static/ directory as well which is not suppose to happen. Just the outer static directory should be ignored.
You need to add static
to your .gitignore file.
The forward slash is stopping git from finding the directory.
Edit 1: You may need to run git rm --cached static
if the folder is already being tracked by git.
Edit 2: The poster's criteria have changed and they only want to ignore the static
folder in the root directory.
Just add /static
to your .gitignore file (and remove static
) .
This is discussed here in another Question.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.