I recently came across a .gitignore file that started some newlines with ./
. I had no idea what those ./
s did, and I was very surprised to find out that this was both a) a seemingly novel question, and b) very hard to find answers for.
I've seen these related questions, but the function of ./
in gitignores seems to be different from that in the bash terminal.
My testing seems to indicate that ./
just doesn't do anything. Given a folder structure:
C:.
│ .gitignore
├───bar
│ bar0.txt
├───baz
│ baz0.txt
└───foo
foo0.txt
And a .gitignore
# .gitignore
./foo
./foo/*
./foo/
bar
/baz
If I do git add -A
and git status
, only these files are tracked:
new file: .gitignore
new file: foo/foo0.txt
So, what is the purpose of ./
?
Edit: I'm on Windows.