Welcome to the second part of this series. Today we will talk about setting up source control.

Why do we need source/version control?

I think I won’t add anything new to the conversation if I say the following are some of the nice features any version control offers:

  • consistency of file and directory names among all team members
  • easy to revert changes
  • better team communication
  • potentially easy deployment of code
  • tracking what was changed and who made the change

Why did I choose Git?

Apart from the fact that there are tons of reasons specified elsewhere why Git is great, I just like the simplicity of it. And its fast!

Why Git and Dropbox?

Dropbox provides a great way for me to keep my repository on the cloud, thus constantly maintaining a backup. Dropbox works great with Git, though I would think any source control software that has a file base structure would be fine with this setup.

Lets get started.

Please keep in mind that this is not a tutorial for Git or Dropbox.

  1. If you haven’t setup Git already, do so. On windows download the latest release of Git Extensions from  https://code.google.com/p/gitextensions/downloads/list
  2. Install the package and keep “Open SSH” on the option page (you will see)
  3. Once Git is setup, start git-bash
  4. Change directory (cd) to the folder where you plan to do keep your working copy of the code (c:projectmyProject in this example)
  5. Once in the folder, setup a new git repository using the following command – git init
    1. this will work even if the code already exists (existing visual studio solution)
  6. Add a gitignore file suitable for your Visual Studio project – touch .gitignore
    1. The information from this link can be copied into this file – https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
  7. Now we will add the initial changes to our to-be-commited list – git add .
  8. Now commit the changes to the local repository – git commit -m “Initial commit”
  9. Change directory to Dropbox folder – cd c:Dropbox
  10. Create a new directory to store your cloud repository – mkdir myProject
  11. Change directory to newly created folder – cd myProject
  12. Create a bare Git repository – git init –bare myProject.git
  13. Change directory back to your original working copy repository – cd c:projectmyProject
  14. Add link to remote repository – git remote add dropbox c:DropboxmyProjectmyProject.git
  15. Push current changes to remote repository – git push dropbox master

You are all set now! Now you can clone this bare repository from any machine with the same access to the Dropbox folder myProject.