Slides: Git for .NET Developers
Links
- Git Project Home: Info and reference materials
- GitHub: Popular hosting for Git projects with free public repos or private repos with paid accounts. Get the GitHub for Windows client from here or use the GitHub plugin in Visual Studio 2015 RC.
- Visual Studio Online: Online TFS with Git as a source control option. Free accounts with unlimited private repos all integrated with the rest of the TFS tool suite.
- Brian Harry wrote a blog post about TFVC vs Git feature support in TFS that might be helpful when deciding which source control option to choose for a TFS project.
- BitBucket: Alternative to GitHub. You can also get the SourceTree tool that we looked at from here.
Demo Project
I have a demo project on GitHub to try out anything you want against a shared Git repo. Try out forking or cloning from it or let me know if you want to be added as contributor to the original project. It’s not a real project so don’t worry about breaking anything.
Quick How-To’s
I often set up a Git repo to use with throwaway prototype projects to make it easy to try out lots of different things and keep a record of everything I tried. An extra advantage is that I can make a quick backup of the repo and then get rid of the working folder to keep my disk clean. I can then get the code back later or share it with someone else from just a single file.
To create a single file backup try the command:git bundle create c:\temp\MyRepoBackup.git --all
If you’re working on a project using TFVC as main source control and want to also use Git as local personal source control you need to make a few changes to trick VS into ignoring the Git repo so you can stay connected to TFS. See the structure in this example repo.
The changes to make are:
- Rename the .git folder, for example: _git
- Create a new text file named .git in the repo folder.
- In the new .git file add a line to specify the new folder name, i.e.: gitdir: _git
Now Visual Studio should ignore Git and allow you to use TFS instead but other external Git tools should work as normal in the same folder.