• Now all data be ready for publish, We had made our blog alive now. Haha.



  • These days CCP GFW blocked all the IPs from US and when I switch my IP in google Cloud, the disk data cannot be restore again. I have to restart my blog totally, Now the website is still building…



How to make Git “forget” about a file that was tracked but is now in .gitignore?- Stack Overflow

Python PingBook 2 months ago (10-26) 15 0

Question

There is a file that was being tracked by git, but now the file is on the .gitignore list.

However, that file keeps showing up in git status after it’s edited. How do you force git to completely forget about it?

Answer

.gitignore will prevent untracked files from being added (without an add -f) to the set of files tracked by git, however git will continue to track any files that are already being tracked.

To stop tracking a file you need to remove it from the index. This can be achieved with this command.

git rm –cached

If you want to remove a whole folder, you need to remove all files in it recursively.

git rm -r –cached

The removal of the file from the head revision will happen on the next commit.

WARNING: While this will not remove the physical file from your local, it will remove the files from other developers machines on next git pull.




Copyright from PingBook Blog, If not specified, they are original. This site uses BY-NC-SAProtocol authenticated.
For reprinting, please indicate the link of the original text:How to make Git “forget” about a file that was tracked but is now in .gitignore?- Stack Overflow
LIKE (0)
[1725641479@qq.com]
SHARE (0)
PingBook
Author:
We create, We sharing! Tag every value data your sharing
Submit comments
Cancel comments
emoji picture bold strikethrough center italic check in

Hi,you need to provide your name and email adress!

  • Name (Required)
  • Email (Required)
  • Website