I like Git over TFVC
I’ve been on a new contract and we are using TFVC here. It’s a decent tool (used to be THE tool and was much better then SourceSafe before that) for version control (you’re doing version control, right??!!), but I’ve found myself saying “Git is so much better” out loud. I do really miss Git, but I need to be careful in presenting change (I don’t want to cause angst or feelings that things can’t be changed in the developers current company. I want to provide a view of what I and others at Omnitech have experienced as good and helpful to the development process).
The following are some reasons I’ve thought of, with help from my co-workers on MS Teams, on why a team might go through the disruption of changing version control, training, learning, questions and updating builds. Will it really help and increase our productivity and developer happiness over the long run?
I was a part of a different company that went through a TFVC to Git transitions a few years back. It took me a few months to get comfortable, so I’m aware of the learning curve. We definitely relied on our Git guru to fix our branch messes, but after a few weeks we all adapted well.
A few things I like about Git
Some of this is in contrast to TFVC.
- Pull Request work flow and UI with Azure DevOps
- TFS 2018+ and Azure DevOps has a very nice web interface
- policies on PRs that require tests to pass, approvals, etc.
- TFVC - code reviews disappear after “looks good”, you don’t see the updates
- Moving files and folders is much easier
- Local branching workflow
- Easier to collaborate
- Light weight
- Trunk based is easier
- Local commits provide an easy way to back out of local changes
- Switching branches is really fast
- Less frustrations once you move to it
- This is subjective, but I’ve pulled my hair less when working with Git (after I got the hang of git)
- What if TFS goes down or is unavailable?
- Merge more quickly
- Work with others more easily (point them to a branch)
- The Azure DevOps Team uses it, moved from TFVC “increased agility”
- You can use the GUI or the command line (and don’t have to be only in Visual Studio)
Overall, I feel more productive with Git (after the initial learning curve) and that I’m not fighting with it the way I do with TFVC. I feel that the pain to switch (and lost time) will be more then made up with by the PR improvements, culture improvement possibilities, easier to find experienced Git Devs and branching.
TFVC frustrations (venting)
- Get specific version to override (it didn’t get latest and I’m missing files?? This gets me every once in awhile)
- adds a read-only file flag, I’ve had to manually remove this
- when working outside of VS (think VS Code or Notepad++) have to find in Source Control explorer, then right click check out for edit.
- Checks out files I didn’t change on build (Service Fabric solutions)
- We get code review comments that say “nothing changed”. To avoid this you have to go through each file and compare with latest. (Git compares the file and doesn’t just remember that you checked it out at some point).
- I spend a lot of time in the Source Control Explorer and clicking through folders to find my file.
- I have to undo changes when I add something then delete it (before checking in)
- When merging a suspended work or shelveset “TF203100: You cannot un-shelve a change to $/[some file] because a deletion of this item is already pending in your workspace. You must either undo the deletion or exclude this item when you un-shelve the shelveset.”
- When I need to merge to QA or RC (we can’t all live in the TBD world, though we’re trying to get there) I have to suspend work, merge, check in, suspend and delete that after the Gated build finishes. It’s hard to do other work in the middle.
- The merge window from branch to branch sometimes takes 30+ seconds to load up when choosing selected Changesets.
- The merged changesets don’t always disappear from the merge window after being merged.
- Resuming suspended work timed out on me today… stuck in the loading state in VS. I’m going to have to kill VS.
- Open the solution before connecting to the VPN (or TFS is down), then I get prompted to Go Online.
- It’s not easy to see changes or got back for long lived feature work.
- I almost lost a day of work when I was switching between shelveset with the Suspend and Resume work (too much context switching), but my files disappeared at one point. Thankfully, I was running a local git repo and was able to revert the commit where it disappeared. It had occurred when I got latest.
- It promotes long lived, large change-sets as the normal process.
- Each branch requires a new folder structure and full copy of the code.
- Trying to move files, then to suspend my work to create a shelveset isn’t always easy
- Moving files to different folders is not fun!
- I like to re-organize often, but in TFVC it becomes a headache. So people don’t re-organize and things stay in a mess or become worse.
- Branches are complete copies and you have to remember which folder on disk you are on.
- Have you ever started coding and realized you’re in the wrong place?
- TFS OnPremise goes down, re-connecting isn’t easy
- If you’re doing local Git:
- move the .git folder into a different directory
- Connect to TFS
- Right click solution, then go online
- Wait for the dialog to populate “offline changes made to this solution”
- choose all the files you need to be added or marked as edited, since you lost connection
- then move the .git folder back in. Don’t do that before you make the solution online!
- remember to click no on the dialog that asks if you want to switch source control provider.
- Then It feels like a fight to get it connected.
Local version helps?
Months after I wrote this, A co-worker pointed out changing the location to local from server.
“A caveat to the local workspace is that it can make some TFS operations take longer since it creates some extra local data on your machine to make it so it can catch changes to the local workspace. Also, shelvesets become more important because a local workspace won’t regularly sync your workspace to the server and save your changes with the server.” ~Ryan
I’ll try it out and add some more thoughts someday (if I remember :-)).
A few things I like about TFVC
- It is way better then SourceSafe was.
- We definitely needed it when it was introduced with TFS 10 years ago
- The Suspended work is a nice feature.
- Code Reviews are a good feature (but Git Pull Requests and UI is much better)
Donovan Brown’s insights
Donovan Brown does a great job presenting DevOps and happens to work at Microsoft. The Azure DevOps tools are really good and the team there has made the transitions themselves.
In August 2018, Donovan tweeted.
"Don't move to Git because others have. Move if it addresses a problem you are having. If not @VSTS has your back with TFVC."
This points out that you don’t have to move if you’re happy with TFVC and don’t want to make a change. However, there are many comments that point out the benefits of Git. One at the top from @t3rse (how I’ve had the pleasure working with and am proud to call a friend) said “I disagree. Being forced to think like a git improves engineering skill, not just for Microsoft but for literally anything. My guess is there are zero jobs that don’t require a deep understanding of git outside the halls of MSFT.”
Later on, Donovan responds to this and others “I would agree more with your statement if we did not offer both. But we do. You want Git fine. Not ready for Git fine. How is giving people choice a bad thing? You choose what is best for you.”
@TfsBuck is another good source for a Microsoft Azure DevOps engineer.
Donovan did an interview/conversation about Git in May 11, 2018 at Build.
Notes from their chat
- the 2017 StackOverflow survey said 87.2% use git in some way
- Branching is cheap
- leads to developers merging more quickly
- Avoid “Merge Bomb”
- Protect my peers?
- Pull Requests
- Protect master
- Approval required
- VSTS team (now Azure DevOps) uses it, moved from TFVC “increased agility”
- Learning Cure?
- Use a GUI
- Lot’s of resources are out there
How to transition?
Now that you’re convinced you want to use Git (you are convinced aren’t you?) and that it’s good for your team, how do you move towards it?
In my experience…
Identify 1 or 2 people that are or will be Git experts, learn yourself
You need 1 or 2 people that are Git experts ready to help others when they make a mess of their branch. Identify that person(s). Do you need to dig in and learn before introducing to your team? The rest need to know how to do the basic steps either in Visual Studio or GitHub Client or in the command line (see my article Some Git Help for 5 easy command line steps to getting latest into your branches).
You can start using Git, while still using TFVC. It’s a great way to practice and to get used to creating small commmits. It also gives you a way to look through your personal history and revert/go back if you decide to undo in the future. It also gives you a back up in case you loose something with suspending and resuming (like I did last week). Visual Studio gets a little confused, but I’ve had good success using the Github client. Remember to still create some shelve-sets so you get a code backup on the TFS server and to make sure you have all the files marked as “add”.
All you have to do is go to the root directory in the command line and type
git add .,
git commit -m "initial". You’ll probably want a .gitignore file first.
Share your excitement, talk to the team, build consensus
You need to be able to be the champion for change. This includes sharing stories (like mine and others), videos, articles and showing what you’ve learned. Have some lunch and learns, show off how to use git and a Pull Request in GitHub or Azure DevOps, start a book club (the Pro Git book is free!!). This may take some time.
Emphasize small local git commits and good Git practices. Talk about the way you want to do at your company.
Do you have a multiple branching code for change isolation? Talk about how to do that now in Git. Maybe this is even an opportunity to start the transition to Trunk Based Development, but don’t take on too much at once. The move to Git will be disruptive enough.
Make sure most are on board and be ready to help those who need help!
Now that people are aware of it, it’s time to see if you’re team is ready. Talk to your team and your manager about how to get the priority to introduce this change and possible interruptions.
Come up with a plan
I’m thinking about Azure DevOps pipelines as I write this.
- Will you try it with a pilot project or go all out across the whole company?
- Will you go with one big repository or several small ones?
- Google does one giant repo
- Think about how your teams are organized.
- Update builds and release
- get source tasks
- Do you have custom powershell tasks for versioning, etc that check things into source?
- Migrating the source code from TFVC to Git.
- What tools are available?
- Azure DevOps has a built in tool
- History, do you need it all?
- “You can migrate up to 180 days of history starting from the most recent change-set. A link to the TFVC repository is added in the commit message of the 1st change-set that is migrated to Git. This makes it easy to find older history when needed.” ~ Azure DevOps link
- What policies do you want to add to your Pull Request to improve quality?
- You have a GCI build already, right??
- 1 or more approvers? Someone from a specific group?
- Can you approve your own changes?
- Plan for time for the “expert” to help with others changes.
- Plan for a retrospective in a few weeks
- Share the wins and challenges with other teams and help them make the transition
What do you think?
Do you have an argument not to move from TFVC that I didn’t think of?
How’d your transition go?
Finish with a cheer
The title feels like a high school cheer chant. It reminds me of marching band, “I’ve got spirit how about you?” that we’d yell to the other schools.
Minions cheering seems to fit…