Team Foundation Server and Xcode projects with git-tf

Avatar

Charles

 

One of the Team Foundation Server Developers, Edward Thomson, reached out to me this morning:

Any way I could get my blog with the fancy new VS 2012 styles?

My answer was:

“We are only doing this for the team blogs…any reason you aren’t posting to the ALM blog?

Turns out he didn’t know to do this…Doh!…Shame on me! 

Sounds like I need to send out a another “on boarding email” to the team…In either case I want to welcome Edward Thomson to the ALM Team blog and I copied one of his latest posts below…

********************************************************

 

Brian Harry announced the availability of git-tf last Monday, a new tool from Microsoft that allows you to create a local git repository from a path in Team Foundation Server, then check the changes in your repository back in to TFS.  This tool is another piece in our cross-platform support, aimed at users of IDEs that don’t have built-in TFS integration.

We hope that Xcode users will find this particularly useful, as Xcode sadly lacks a plug-in model that would allow us to build TFS support natively.  Xcode does have git support, however, so once you’ve created your git repository with git-tf, you can use Xcode’s source code integration directly.

This means that if you’re writing mobile applications, you can now use Team Foundation Server as your ALM solution for the entire development team.  Imagine you have your shared business logic in C, you have a Windows Phone 8 version being developed in Visual Studio, an Android version being developed in Eclipse and an iOS version being developed in Xcode.  Now all your developers can take advantage of TFS Version Control – your Visual Studio users with Team Explorer, your Eclipse users with the TFS Plug-in for Eclipse and your Xcode users with git-tf.

I’m too hopelessly old-school to be hip to the new mobile apps, so I’m going to show how I work on a cross-platform command-line application that plays blackjack.  I’ve got my source in TFS, with an Xcode project side-by-side with my Visual Studio solution:

Once I have Xcode and git-tf installed on my Mac, I can download this project easily:

Now I have a git repository that represents my TFS changesets, with full history.  (That was the --deep option, without that I would have a single git commit that represents my latest TFS changeset.  This is quicker to compute and useful if you don’t need full history.)  You can see that my history in Visual Studio:

is the same as the history in my local git repository:

When I open up this project in Xcode, you’ll notice that when I start making changes to files, they’re automatically added to my git index, as denoted by the small M next to the filename in Project Navigator.  Below, I’ve made some changes to my project’s assertion logic, changing Assert.cpp and Assert.h.

When Xcode’s source control integration, I can commit these changes to my local git repository from right within my IDE.  When committing, it will show a handy diff viewer for each file in my commit.

You can see the two commits I’ve made in my Xcode project in my git log.

Once I’m done making changes locally and I want to integrate with the rest of the team, I can check them in to my TFS server using git-tf checkin.  Just like when I cloned my project, I can use the --deep option to preserve history.

Back in Visual Studio, you can see both of these changesets in my TFS history.

And, of course, since I’m doing Continuous Integration builds for this project, as soon as I checkin from git-tf, TFS queues up a build for me.  In this case, I get two – one for each changeset, since I did a deep checkin from my two git commits.

So you can see that now I can easily use Xcode to take advantage of the ALM functionality of Team Foundation Server, providing every developer on a team with intuitive access to TFS Version Control.

git-tf is available now on CodePlex, Microsoft’s Project Hosting for Open Source Software and we’re making git-tf available open source under the MIT license.  We think this is a very useful tool right now, and we’re looking forward to making it even better.

Avatar
Charles Sterling

Follow Charles   

No Comments.