This is a simple implementation of source control on cloud and its integration with Visual Studio. I am using two terms, source control and Cloud which can be managed by the following masters:
As a developer, I used to have vss/tfs or git to manage version and source, however everything is local as I can't afford a server or cloud to hold my code. After using git and dropbox on side lines, I had a thought to use them as a single entity where we can manage our code using git and push it to permanent/accessible cloud system (dropbox), hold on ... and also we can share our dropbox folder with peers/friends too. So isn't this making it a complete client server/cloud based version control that can be used by multiple users like any other tools available in the market .... but for free.
Hence I Googled it and found about 247,000 results (of course, I was not the first one on earth who thought about that). Anyway, most of the solutions were complicated for a git novice like me. So I found a simpler way to achieve it and integrate with Visual Studio too.
- Install git extension and Dropbox and of course
- VS 2010/12 (or newer)
- In addition to this, we would require some interface by which we can link Visual Studio to Git Source Version Control. To achieve this, Go to ‘VS->Tools->Extension and Updates’ and search for "Git Source Control Providers" and download it.
- First we need to make Source Control Selection for VS. Go to "Tools->Option->Source Control" and select Git Source Control Provider.
- I assume that after installing Dropbox, you must have a folder called “Dropbox” , So navigate to that folder and create a new folder to hold our shared/centralized repository, named it like “Repos” (or as you wish).
- Now, we need to add project under git version control. It can be done easily by right clicking solution or project node select “Create new Repository”. It will create a LOCAL repository. Now open “Pending Changes” window and select all files and click on commit.
- We would require a centralized repository that can hold our code/source. So there are two ways by which we can create an empty Centralized repository.
- Go to Dropbox->Repos folder, right click and select "Git Init Here" and rename newly created .git folder with "demo.git".
- Go to VS, open your project (that is already in local git control) and find pending changes Window and click on Git Bash or right click Solution node in Project explorer and Select git->Git Bash. This will open a console window.
Navigate to target folder by typing the following command in console:
$cd d:\\ Dropbox \\ Repos
$git init --bare demo.git
Any of the above two steps will create a new fresh repository.
- Now to add that local project to this newly created repository, we need to add one remote.
- Open GitBash from project and type the following command:
git remote add demoremote d:\\dropbox\repos\demo.git
- Now push changes using:
git push demoremote master
The above command will push your previously committed changes to central repository.
- Let's assume that your peer does not have this project yet, and then he/she needs to clone your centralized (demo.git) repo to his machine. To do this, first he/she has to comply with all prerequisites and you need to share your “Repos” folder with your peer using Dropbox.com.
- After sharing completes, your friend/peer will be able to access “Dropbox/Repos” on his machine.
- Open GitBash in peers computer, navigate to target folder where you want the source code copy and use the below command:
git clone file://g:\\dropbox\\repos\demo.git
(assuming that your peer has dropbox in g:\\ drive)
- Your peer can create some remote to push/pull changes from/to repository (as described in step 5).
- All things are in place. Now when someone pushes up their changes, you can simply get them using the below command:
git pull someremotename master
or by right clicking in solution explorer, any file git->pull.
I really explained it in length as I tried to cover git integration with Visual Studio too, but it is simple and quick. I/we learned a new way to do old things in a very innovative and efficient way. Please leave your comments. If you have any doubts/queries, I will try my best to answer you.
(Disclaimer: I have not mastered git, just started using it.)
Folks, the world is open to tweak, hence this approach too. Please make it more usable/optimized/relevant as per your requirement.