gitignore + commit with excludes = bug
- From
- Paul Jackson <mailnew4ster@gmail.com>
- Date
- May 1, 2021, 18:37 UTC
- Message-ID
- <CAGKR6vKwojz8_bs9oRasQPCamZJ-4mrmBKBZQCJKhX=8w+SzDg@mail.gmail.com>
Hello,
I stumbled upon what I believe is a bug in git. See the following reproduction steps:
mkdir test cd test git init echo 1 > ignored echo 1 > not-ignored echo ignored > .gitignore git add -A -- ':!ignored' || echo 'ERROR!!!'
In these steps, I ignore the "ignored" file twice - first time in .gitignore, and second time in the "git add" command. I didn't expect this to be a problem, but I'm getting the following error message:
The following paths are ignored by one of your .gitignore files: ignored
It looks as if git thinks I wanted to include, not exclude "ignored" in "git add".