This blog tells you how to migrate your TFS Version Control to Git step by step.
What is TFS:
Team Foundation Server (Microsoft TFS) is a centralized version control system that provides a central location for the teams to access and collaborate their efforts/work.
What is GIT:
Git is a modern and most widely used Distributed Version Control System designed to handle small to large projects with speed and efficiency.
Git also has excellent support for branching and merging, leading to many innovative and powerful workflows and tools.
TFS Vs GIT:
|TFVC is a Centralized Version Control System – CVCS.||Git is a Distributed Version Control System – DVCS.|
|It can be viewed only if connected to the server.||Offline repository access.|
|Offline actions like commit and seeing history are not possible since the local repository can't save "changes".||One can see the changeset history offline or commit offline locally.|
|TFS is not that fast as compared to GIT||Git is faster than TFS as everything is done locally.|
|There is a risk of losing your work if the TFS Server is unreachable or you forgot to check-in the code.||It saves all your work on a local repo, so you don't have to worry if your system crashes or you forgot checking in.|
|No concept of a local branch.||GIT allows the developer to create as many local branches, and he/she can quickly merge the local branch to the remote branch after completion of work.|
GIT Advanced features:
- Version Control System: Many developers can add code concurrently. So, Version Control System helps in handling this by maintaining a history of all the changes.
- Distributed Version Control System: DVCS means each developer has the entire repository, including the whole change history on his/her local machine. So, the developer can commit changes offline to his local repo and see the changeset history offline.
- Pull Requests: Pull requests let you tell others about changes you've pushed to a branch on GitHub. Once a pull request is created, you can review/discuss the potential changes.
- Code review: Reviews allow team members to approve, request further changes, or comment on the proposed modifications in pull requests before merging.
- Branching is easier: One of the best features of GIT is Branching capabilities. Branch in Git is used to keep your changes until they are ready while the main branch (master) remains stable. After your work is done, you can merge it with the main office.
Migration steps TFS to GIT:
Due to the differences in how TFS and Git store version control history, we haven't migrated the history.
Step 1: Download the latest project code from the TFS server
Get the latest or download (if not available) the project code files from the TFS Server on your local system.
Step 2: Sign up and installation
Go to GitHub and sign up for an account, if not already. Also, you need to install Git; it's required if you want to work on your local computer.
Step 3: Create a GIT Repository
A GIT repository is a virtual storage of your project that saves different versions of your code. You can keep code files, images, or any files in a repository.
Step 4: Clone the repository
Now, you might want to clone your new repository so that you can work on it on your local computer, or you might have an existing repository that you want to clone.
So, you need to paste the URL of the newly created repository while cloning through your desktop application.
Step 5: Add Code files to the new repository
You are all set to add code files to your new project repository. Take the latest code from the local project folder and add it there.
Post that, you need to push the code to Git online. Click on "Push Origin". The code will continue to upload on Git.
Step 6: Create Branches and Perform Operations
Branching in GIT helps you to work on different versions of a repository at the same time. Branches allow you to move back and forth between the different versions of a project.
After creating a new branch, you can publish that branch remotely by clicking on "Publish branch".
Benefits of using GITHUB:
- It saves all your work locally, so you don't have to worry if your system crashes or in case of hard disk failure.
- Multiple developers can code parallelly in the same file, and a centralized SCM enables us to combine these with lesser conflicts.
- It supports non-linear development and rapid branching and merging through its thousands of parallel branches
- GitHub keeps track of all the changes that have been pushed to the repository.
- Branching and merging are easy.
About the Author
Mridul Mahajan, Software Engineer in Web Technologies |ADM