I have a file named “myfile.php” on my server and in my computer.
I want to remove myfile.php from git index in order to prevent changing myfile.php in server.I do this by adding the file to .gitignore and removing the file from index with “git rm –chached myfile.php”
Now when I run “git pull” it removes the file itself from working directory in server but I want to keep it on the server and just keeping it safe from changing.
What’s the problem?
I have a file named myfile.php on my server and in my computer. I
Share
If you accidentally added to the index a file you want to remove from the index (but not delete from git’s history) then use:
Also, you can note that when you execute
git status, git will actually tell you this: