If you forget to add something to .gitignore, for instance, test-output/ and you review your changes and see the files got into the staging area through a
git add .
adding test-output/ to .gitignore and then adding that to the commit does not make the files disappear from the staging area. Furthermore, attempting to remove them with
git rm -r test-output/
is disallowed. In this case, I was able to just remove the folder and do add again. Is there a better way?
You can unstage the folder
test-outputby doing