trouble with gitignore
.gitignore I expect that *.log files under directory
test will not be included in any git transactions
:> cat ~/test/.gitignore */*/*.log */*/*__pycache__* */*/*out
However I have this conversation which suggests my gitignore is not defined to do what I expect.
Where is my error? Am I misinterpreting the conversation or is my .gitignore incorrect for what I expect.
:> git add . === :> git status On branch master Your branch is up to date with 'origin/master'. === Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: ftp.log === :> git restore --staged ftp.log === :> git status Untracked files: (use "git add <file>..." to include in what will be committed) ftp.log nothing added to commit but untracked files present (use "git add" to track)
A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere, the same as pattern "foo". "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo".
Familiarise yourself with https://git-scm.com/docs/gitignore#_pattern_format
An asterisk "*" matches anything except a slash.
It looks like you want
*.log instead of
*/*/*/...; it will wildcard match all .log files in all subdirectories.
.gitignore matches files in reference to the repo’s root directory, both hard references (
/foo/bar) and soft references (
If you just want to exclude the directory
test you can add a new .gitignore to the
test directory with the following:
You can also replace what you have in your current
to remove tracking from all
.log files in directories of the project.