Hello, GitHub

I’m a little behind the times. I’ve been committing my code to an SVN repository for the last five years, and the interwebs are all about Git these days. I decided to take it for a test drive. But with what?

Almost a year ago, I started working on a data structures library in C# — not a useful library, just something I whipped up to essentially prove that I could still write a linked list and perform operations on it (such as reversing and sorting). It’s hardly something to brag about, but it’s a perfect test candidate for Git.

I went looking for my project, and boy, does my ignorance know no bounds. When I authored this library, I thought it would be best to test it out using a console app, spitting out values to the console, and inspecting the output by hand. Obviously, I should have just expressed that as a series of unit tests, but I probably felt that doing so would slow my progress with the library. Stupid. So, I converted the console code to a series of unit tests in MSTest. (I’ve only ever used NUnit, but hey, this is an adventure, right?) And besides, I was going to be committing this code to a public repository on Github, and I wanted to spare myself from embarrassment.

From there, I created an account with Github, and set up my first repository. Next, I installed Github for Windows to clone the repository on my local machine.

Everything was in place. But, to make things a little easier, I installed Git Source Control Provider plugin for Visual Studio, which also required the installation of straight-up Git. (By the way, Github’s instructions for setting up Git are very good.) Using this plugin was certainly a welcome change from managing my source from outside the IDE.

Via the Git plugin, I added all of the necessary files to the repository from within Visual Studio. Perfect. At this point, I had my data structures solution in Visual Studio 2012, complete with unit tests, and code fully committed to the local Git repository. The next logical step was to click “sync” in Github for Windows to sync all of my local changes with Github. Right? I did that, and received this gem:

Github for Windows: Unstaged Changes Error

Github for Windows: Unstaged Changes Error

OK, so how do I “stage” my changes? Sure, I could open the shell, but do what, exactly? Well, Github for Windows seemed to offer no solution, so the shell quickly became my only option. I fired up Git Bash (part of Git), and typed git commit to see what happened. The response was that there was nothing to commit. Ah, so git commit is only local. I typed git help to see what other options were available, and git push looked like it had some potential. I tried that out, was prompted for my Github credentials, and bam — all of my local commits have been pushed up to Github.

I’ve only gotten started. I have more code to add to the project, and I will try adding it from multiple machines to get a feel for the experience of team collaboration with Git/Github. Look for those details in a future post.

Update: Github for Windows JUST made a liar out of me. I repeated all of these steps on another machine, made a small change, synced from Github for Windows, and pushed the changes to Github without any problems. Go figure!

Update 2: It wasn’t Github’s fault, it was mine. It helps when you point Visual Studio’s Git plugin to Git running on Windows.

Incorrect Path to Git for Windows

It helps when you provide a valid path to Git for Windows.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: