-1

In linux, I am using git. I initialized git in a project that already I had been working. I am in two or more commits now. Now only I came to found that my project has lot of temp files made by the Text Editor 'gedit'. That files ends with '~'

For ex.,

index.html~

and so on... Now I need to remove all the temp files from my project directory. So I added the following line in my .gitignore file.

*~

But it still tracks the temp files. What should I do for not to track those temp files in my repository?

Smith Dwayne
  • 2,675
  • 8
  • 46
  • 75
  • Possible duplicate of [Ignore files that have already been committed to a Git repository](http://stackoverflow.com/questions/1139762/ignore-files-that-have-already-been-committed-to-a-git-repository) – Edward Thomson Jul 01 '16 at 11:21

2 Answers2

0

From here: http://blog.mikeski.net/blog_post/12

First, remove them from the filesystem (on Unix I do):

find ./ -name '*~' -exec rm {} \;

Then remove them with a BASH for loop

for x ingit status | grep deleted | awk '{print $3}'; do git rm $x; done

If you're on Windows, switch to Linux...

mikeb
  • 10,578
  • 7
  • 62
  • 120
0

Add them to ignore

If they are still untracked run this

git rm -r --cached <file>
Maksym Semenykhin
  • 1,924
  • 15
  • 26