Team Foundation checkout vs Git checkout

Source Control Checkout

I have a friend that has been using Team Foundation Server to manage his projects for a long time. He knows all the commands to create branches, merge, annotate, get latest, checkout, etc. However, when we started using Git, he was expecting the checkout command to perform the same action as Team Foundation.

In Team Foundation, the checkout command allows you to make changes to a file and also specify a lock type. In visual studio 2012, I see 2 options for lock type:

– Unchanged – Keep any existing lock and
– Check In – Allow other users to check out but prevent them from checking in

After you have selected the lock type, you can click the “Check Out” button and the file will be in edit mode and ready for you to make changes.

In Git, the checkout command is use to switch/create a new branch. If you want to switch to an existing branch, you can run the following command:

$ git checkout existingBranchName

If you want to create a new branch and switch to it, you can run:

$ git checkout -b newBranchName

To see the full list of available options for the checkout command, visit the official git documentation site @ http://git-scm.com/docs/git-checkout.

Hopefully this will help other developers using git coming from a Team foundation background.