While using GitUp I noticed some strange behaviors that I reported to @swisspol, the author of GitUp.
I reported the problem on the GitUp forum but it seems to be a libgit2 bug, which GitUp uses to interface with the repository and .gitignore files.
GitUp uses a slightly forked version of libgit2 which is based on e0ab1ca as of GitUp b1009 (which still shows the problem).
I created a demo repo on GitHub to showcase the problem.
I will use GitUp as a reference, but its behavior should depend on libgit2 as far as I know, so please excuse me if I use its own behavior as the culprit.
Here are the steps that I followed (details below):

- Create and commit a
.htaccess and .gitignore file in the root of the project. .gitignore ignores everything and then adds some exceptions, for itself and for the .htaccess file.
- Create a
test/ directory with a test file in it, in my case the file is test.php
- Create a
.htaccess in the test/ directory with some dull content in it
So far so good. Now things start to get messy.
- Force add
test/test.php even if it's in a ignored path and commit
After adding a file in the test/ directory that is ignored, now the base .gitignore rule is applied to this directory too, and GitUp shows the .htaccess file.

- Try removing the
test.php file: git rm test/test.php, and the .htaccess file disappears.

- Try force-adding another file, for example a dummy
test/robots.txt file, and even before committing, the .htaccess file appears

As you can see in the first screenshot, git correctly ignores the files in the ignored directory (you can see a git st which is alias for git status. I originally experience this bug with a node_modules directory not being ignored, which is a problem because there are a ton of files in the working directory that should be ignored and create a lot of noise.
While using GitUp I noticed some strange behaviors that I reported to @swisspol, the author of GitUp.
I reported the problem on the GitUp forum but it seems to be a libgit2 bug, which GitUp uses to interface with the repository and .gitignore files.
GitUp uses a slightly forked version of libgit2 which is based on e0ab1ca as of GitUp b1009 (which still shows the problem).
I created a demo repo on GitHub to showcase the problem.
I will use GitUp as a reference, but its behavior should depend on libgit2 as far as I know, so please excuse me if I use its own behavior as the culprit.
Here are the steps that I followed (details below):

.htaccessand.gitignorefile in the root of the project..gitignoreignores everything and then adds some exceptions, for itself and for the.htaccessfile.test/directory with a test file in it, in my case the file istest.php.htaccessin thetest/directory with some dull content in itSo far so good. Now things start to get messy.
test/test.phpeven if it's in a ignored path and commitAfter adding a file in the

test/directory that is ignored, now the base.gitignorerule is applied to this directory too, and GitUp shows the .htaccess file.test.phpfile:git rm test/test.php, and the.htaccessfile disappears.test/robots.txtfile, and even before committing, the.htaccessfile appearsAs you can see in the first screenshot, git correctly ignores the files in the ignored directory (you can see a
git stwhich is alias forgit status. I originally experience this bug with anode_modulesdirectory not being ignored, which is a problem because there are a ton of files in the working directory that should be ignored and create a lot of noise.