It's needed for the following case:
```
/J/test.txt
/H/dirJ/test.txt
```
When my .gitignore contains ```J/`` and you don't add the first slash, it will also match dirJ and that's not good. But the pattern was wrong so instead of ```^/``` it should be ```/```. I have added a new test case for it :)