This is my attempt to help out people that are thinking about migrating to git from TFS, I believe git has many advantages over TFS but have seen many people struggle and complain? when using it for the first couple of weeks. To put in context I have used git for 6+ years but was helping the rest of the company I am working for move over to git.
Git for TFS Users
If you just use your source control for checking in and getting latest git is probably going to add some confusion to your workflow. Visual Studio tries to hide the extra steps that are going on under the covers, which is fine when things are going good but will probably lead to you making mistakes because you don't fully understand what is happening when you are performing source control operations.
You're probably going to hate git
Git is not perfect, its complicated and has a horrible learning curve. Here's a site that might help. You might think that you can just switch to git and off you go (how difficult can it be eh?). Try it... go on...
Basic Cycle Differences
- Get Latest
- Check in
Git is a distributed version control system, so it does not necessarily have to have a central repository but i can handle this setup and is probably most used in this way. But it does allow for connecting to multiple "remotes", this means you could directly push between users or setup more complicated systems.
Source Control UsageWhen you first start using source control the purpose is quite simple, let me share my code with the people I am working with and track the changes in a way that I can understand what happened when two people are making changes in the same place. So you need a few basic operations:
- Push my code in
- Get other peoples code
- Merge when bad times happen =[
Nowdays I find myself wanting quite alot more than I used to
- Quick and easy branching
- Ability to merge locally?
- Private areas for subsets of team to work on same code
- Have my source control help me to find where defects where introduced
- Ways to track previous versions so that they can be patched and managed
Source Control as a Tool
There is so much more that you can do with source control than just check in and checkout files.
- Marking previous versions so that you can bugfix
- Working with subsets of your team on features without affecting the whole team
- Managing check ins via code reviews
- Search through history to find out where errors came from
Tips for changing to git
- Make an effort to learn the differences and what is going on under the covers
- Have someone on standby to fix things when they go wrong
- Practice with a test repository before moving over
When you checkout in git the contents of the working directory are changed to whatever commit you are checking out. You maybe are checking out the v0.1 branch. Once this command is run the contents of the repository will be whatever commit the v0.1 branch is pointing to.
BranchingBranching is where git really gets in to its own, its the flexibility and ease of its branching that allows for all the cool workflows and ... that really make git so powerful.
Branching in git is different from TFS, in TFS you branch a folder and essentially have two versions of that folder that have similar contents. In git you branch the working directory, so you can only see one branch at a time (unless you download the repo twice).
ToolsVisual Studio - now has pretty decent git support
Command Line - my personal preference, so much tooling now has good cli interface and requires me to hit the terminal, docker, k8, git, node
References / Further Readinghttp://pcottle.github.io/learnGitBranching/