[Git] How to ignore the commited file

In Git, we can ignore to track of a file or folder by adding their paths into the file .gitignore. However, sometimes we could mistakenly commit and push file and folders that are not needed to be tracked by Git. In such case, .gitignore will be not working. The issue can be solved by the below steps: Add the file path into .gitignore file. Remove the commited file from the git cache by git rm --cached bar/foo.log Commit the changes by git commit -m "xxx" After executing the above steps, you can see the file bar/foo.log is still there but will be not tracked by Git. ...

DigitalOcean Referral Badge
Sign up to get $200, 60-day account credit !