Twitter conversation about version control has brought me to the debate about .git folder appearing in NSF file and how to avoid having it there.
I remember seeing one NSF file with .git folder in it a while ago and I’ve deleted it from NSF without any consequences. NSF is still fine, git repository it is connected to as well. But Cameron Gregor (and probably Sean Cull too) had different experience.
Cameron was kind enough to “record” how this happens on his computer. When I was reproducing his steps I noticed one step different to my usual workflow. It turned out that although I do not use EGit plugin directly to commit changes from on disk project to git repository I am in fact using it in one configuration step. And this turned out to be the crucial step to make it work right.
When you create on disk project, be it by exporting from NSF or cloning remote repository, next step should be to show DDE that this project is under version control. This is done by right click on ODP in Navigator, Team - Share project…, (optional) choose Git (this step is not shown if you have only one VCS plugin installed in DDE), check Use or create repository in parent folder of project and click Finish.
From now on DDE knows this project is under version control and ignores .git folder during sync between NSF and on-disk project.
Lessons learned: you need to install EGit plugin to avoid .git folder to appear in NSF file when syncing with on-disk project. Also worth mentioning is that you do not have to use it to interact with git repository if you prefer to do it from the command line. But you must have it installed.