Ignoring files and folders from tracking in Git repository
Inside your project directory or git repository let’s say you have a file named as password.txt. Now. let’s say that you don’t want to commit this file or you don’t want to take snapshot of this file whenever you are doing git commit, well you can ignore this file from being committed by using something known as it ignore
- Go to your project folder or git repository
- Create a password.txt file
echo "dbpassword" > password.txt
- Create a
.gitignore
file
echo "password.txt" > .gitignore
- Check the status of your git repository
git status
You will not see any files that are not being tracked even though you have added a password file but it is not tracking that password file since you have added that password file inside get ignored