Loading ...

GIT: git .ignore not working, file not ignoring the files mentioned in gitignore file | CodeAsp.Net

GIT: git .ignore not working, file not ignoring the files mentioned in gitignore file

 /5
0 (0votes)

In one of my projects I noticed that ".gitignore" file was not ignoring the files I mentioned in ".gitignore" file. The reason for this was that I accidentaly commited the ignored files too before adding gitignore file. I was not seeing any options in "Git extensions" GUI to revert this. Finally, I was able to to get gitignore working with "GitBash" option. Following are the steps which I did to do the same:

Go to "Git" >> "Git bash"

Run the following three commands in "Git bash" command window one by one:

git rm -r --cached .

Above command will remove everything from the index.

git add .

Above command will add all the files to index.

git commit -m ".gitignore issue fixed"


Above command is to commit the changes with a commit message ".gitignore issue fixed". After running the above three commands my issue was fixed and gitignore file started working as expected.


Comments (no comments yet)

Top Posts