March 04, 2014

Begrudgingly, but Eagerly Using Git

Git is the open source repository that everyone is using in the tech start-up world. Being from .Net, I have used TFS throughout my career and think the tools are great…if it is for .net. So, this article is to demonstrate how I migrated to TFS-git, through some tools that are developed by Github.

I have used source control systems for years. Started with subversion, but mainly worked in TFS. I know the work flow in TFS, and for personal projects, it is super simple. But, with the world of development going to Open Source projects and GitHub more and more, I have to at least learn the trend. You never know where you are going to work, and the more knowledge you have, the better, so why not take your www.VisualStudio.com account and add a git repo to it. The unfortunate thing is that you cannot mix and match repos, but if you use the git platform, it will make it more accessible.

Accessibility is what started this journey. I code, the majority in my free time, node.js. This, of course isn’t the only reason, because I also code on my Mac. Because of these 2 things, it has been super painful to update my TFS repo for every change, basically forcing me to use a VM or a hack of tools. Git, however, has several clients, including a command line and a GUI program, which in this article I will talk about how to use the GitHub for Mac/Windows.

I will assume you have created a git repo, and downloaded the GitHub client from here, mac or pc. What is important is to get 3 things, the git clone url (i.e. https://yournamehere.visualstudio.com/DefaultCollection/\_git/PersonalGit), username and password. Side note, the credentials for TFS are different for the TFS git, which you will have to set up. Now, hopefully, the clients have installed the git command line, so let’s go over to that to type in some commands:

 > cd  </strong> > git clone https://yournamehere.visualstudio.com/DefaultCollection/\_git/PersonalGit > Cloning into 'PersonalGit'... > Username for 'https://yournamehere.visualstudio.com': yourusername > Password for 'https://yourusernamehere@yournamehere.visualstudio.com': yourpassword </pre>  

Don’t worry, that is the last of the command line that you need to worry about, well for now. I only say that because you will want to learn it, eventually. Anyways, to complete the GitHub for “insert OS”, you will need to the client, like here in the picture:

What that “Add local repository” command does is that it tells Github for “OS”, “Hey, Im a Git repository that needs to be set up”. That’s when Github client takes your repo from TFS, or where ever and adds it to it’s “repo” list. For the Windows Github version, you just have to drag the URL over to the Github window (which is different and stupid, but thats WPF magic or something). Now you get the benefit of private repos, and if you want to later, switch over to GitHub and donate some open source software back to the community.