Wednesday, February 5, 2014

Reset gitignore file

follow steps one by one


  
This removes everything from the index, then just run
git rm -r --cached . 

git add .
 
 
To untrack a file that has already been added/initialized to your 
repository, ie stop tracking the file but not delete it from your system
 use: git rm --cached filename 



Instead of .gitignore, you can update local git repository by running following command:
 
git update-index --assume-unchanged <file>
 
 
Put a / at the end of the directory name in your .gitignore file, i.e.
tmp/
If have tracked files inside that directory, you need to tell git to forget about them first (before you add the dir to the ignore list). Assuming you have nothing vital in there (i.e. that you can scratch it):
git rm -rf ./tmp/
git commit -m "untrack tmp dir"
mkdir tmp
echo tmp/ >> .gitignore
git add .gitignore ; git commit -m "add tmp/ to ignore list"
New files in that directory will not be tracked.
The --cached option to git rm only works on the index (pending changes more or less). It has no effect on the working tree or the status of what has been tracked or not.
 
 
git commit -m ".gitignore is now working"  

No comments :

Post a Comment