Monday, November 25, 2013

Github and Visual Studio 2012

While I appreciate that MS has integrated support for Github into VS2012, setting it up is not so intuitive, even with a few resources around the web.  Here are a couple that helped me:

Resources
  1. http://mariusbancila.ro/blog/2013/01/31/visual-studio-2012-and-git/
  2. http://blogs.msdn.com/b/visualstudioalm/archive/2013/02/06/set-up-connect-and-publish-using-visual-studio-with-git.aspx
General Step from the guides above
  1. Install Git Tools from Microsoft
  2. Create your project in VS, and be sure to select the "Create Git Repo" option
  3. Right-click your project in the Solution Explorer, and "Add to Version Contol"
  4. Do an initial commit to your local git Repo
    1. In Team Explorer, click the drop-down and goto "Changes"
    2. Enter in a summary
    3. Click Commit
  5. Sync (in Team Explorer)
    1. From the drop-down click "Unsynced Commits"
    2. Drop in your Github (*.git) location - be sure to include the .git!
    3. Sync
Adding a branch to Github (from Visual Studio 2012)
  1. Create a local branch (Team Explorer --> Home --> Branches --> New Branch)
  2. Right-click the new branch under "Unpublished Branches" --> Publish Branch

Tip:  If you got the "Branch master does not exist error", you can check out the solution in Resource #2.  I have an *unconfirmed* suspicion that leaving out the (.git) extension in step #5 above will cause this error, as I recreated the project, adding the (.git) extension instead, and I can now commit to Master.

Tip:  "Commit" is local, and "Sync" is Github (or remote).  If you are working on multiple branches, don't forget to switch to the correct branch when making your edits.


No comments:

Post a Comment