0

I have read the answers to this this question and just wanted to make sure that I understand correctly. So, if I add a new line in .gitignore to make GIT ignore some folder with a lot of files, that were already added in a previous commit, I can do this:

git rm --cached path_to_folder

This will remove the folder from the git repo, but won't remove the physical folder in my local computer. If I then commit and push this to my github repo, and then go to my remote web server and do a git pull, I would first need to backup the folder on the web server?

Because it will get deleted? I can then restore the missing folder on the web server without worrying about it getting deleted the next time I do a git pull?

TBJ
  • 407
  • 4
  • 19
  • 1
    Why don't you create a new clone and check on it what happens? Doing is the best way to learn something. – axiac Jul 13 '18 at 08:40
  • Yes, learning by doing is a good method. I agree to that. Or I can just wait and see what actually happens after the next pull to my webserver. But my question only needs a Yes or No answer (more or less), so I posted it all the same. – TBJ Jul 18 '18 at 06:23

1 Answers1

0

In case anyone else has the same question... After testing this a couple of times I am now sure that it works as I described above. So the answer is Yes, they will be deleted. But if you then restore them from a backup they will remain untouched the next time you do a git pull, because they are now ignored in the first place.

TBJ
  • 407
  • 4
  • 19