I have a particular issue that isn't quite covered by the scenarios I have found so far, here, here and here (amongst others).
I have a node.js project and have decided not to include the node_modules directory in my git repo (Here are some arguments for and against). However, I am setting up a regular deployment to a testing server and for this I would like to deploy the complete application, with the dependencies loaded (maybe in future I will also include the node server too, but for now just the dependencies).
So I create a test-deploy branch, on which I ignore the vagrant folder, some static pages, etc. I include the node_modules by removing it from the .gitignore file and then push the branch to a remote repository where I have set up hooks to inform my test-server there is a new deploy and it should pull from the remote.
How do I now go about checking out my development branch again? I have tried to add the node_modules back to the .gitignore file but when I checkout my development branch git (rightly so) removes all my node modules as they are not seen as part of the project.