You can run the below commands to stop tracking a file into git. Let’s say we want to remove the data/snapshot.rds file from the git.

git rm -r --cached 'Data/snapshot.rds'
git commit -m "stop tracking Data/snapshot.rds"

Happy Coding!!