This article is a personal note related to
# ignore .txt hoge message hoge.txt # Ignore hoge directory hoge/ # Ignore hoge directory /hoge/
The directory ignored changes first by whether or not to add “/”.
/ is attached first, the directory specified in the relative path from
.gitignore is ignored. If
/ is not attached first, all directories will be searched and the specified directory will be ignored.
Wildcards and nega denying
# .txt all files in the file *.txt # Don't ignore hoge directories !temp/
* can be used with all, and
! can be used for negation. You can also use
[0-9] can also be used.
Specific extension files in a specific directory
# Ignore .txt files in hoge hoge/**/*.txt
When you edit .gitignore but it is not reflected
Causes and solutions for
.gitignore but their edits are not reflected.
It was due to the addition of something once uploaded to git to
.gitignore. In short, I made a commit and pushed it before editing.
.gitignore setting was not reflected because there is still an index in the cache.
- Delete cache
# Delete entire file cache $ git rm -r --cached . # Delete cache by specifying a file $ git rm -r --cached [ファイル名]
Run the above command.
Ensure that the entire file cache is deleted. I haven’t thought of a point where I’m bothering to delete by specifying a file.