# TFS to Git Migration Guide ## Introduction ### Purpose of the Migration The purpose of this migration is to transition our version control system from Team Foundation Server (TFS) to Git. Git offers numerous benefits such as distributed version control, improved collaboration, and flexibility in branching workflows. ### Benefits of Using Git #### Distributed Version Control Git is a distributed version control system, which means that developers can work independently on their local copies of the repository and later synchronize changes with a central server. #### Improved Collaboration Git facilitates collaboration by enabling concurrent development, easier branching, and streamlined code review processes. #### Flexible Branching Workflows Git supports various branching models like GitFlow and GitHub Flow, allowing teams to adopt workflows that suit their development needs. ### Target Git Repository Structure Our target Git repository structure will consist of the following branches: - `main`: The primary branch for production-ready code. - `develop`: The branch for ongoing development and feature integration. - `feature/feature-name`: Feature branches for new features. - `bugfix/bug-description`: Bugfix branches for resolving issues. - `hotfix/hotfix-description`: Hotfix branches for critical bug fixes. ## Git Basics ### Overview of Git Concepts Git is a distributed version control system that tracks changes to files over time. Key Git concepts include: - **Commit**: A snapshot of changes at a specific point in time. - **Branch**: A parallel line of development. - **Remote**: A reference to a remote repository. - **Working Directory**: The directory on your local machine where you work on files. ### Common Git Workflows #### Feature Branch Workflow - Create a feature branch for each new feature. - Develop and test the feature on the branch. - Merge the feature branch back into `develop` when complete. #### Pull Request Workflow - Fork the repository. - Create a branch for your changes. - Open a pull request to merge your changes. ## Branching Strategy ### Choose a Branching Model We recommend using the **GitFlow** branching model for our project. It consists of the following branches: - `main`: Represents the production-ready code. - `develop`: Serves as the integration branch for ongoing development. - `feature/feature-name`: Created for new features. - `bugfix/bug-description`: Used for bug fixes. - `hotfix/hotfix-description`: Reserved for critical fixes. ### Create and Manage Branches #### Creating a Branch To create a new branch, use the following command: ```bash git checkout -b feature/feature-name ``` #### Merging Branches To merge changes from a feature branch into develop, use the following command: ``` bash git checkout develop git merge feature/feature-name ``` ### Collaboration and Workflows #### Setting Up Remote Repositories 1. Create a Git repository on the chosen hosting platform (e.g., GitHub, GitLab). 1. Push your local repository to the remote using: ```bash git remote add origin <repository-url> git push -u origin main ``` ### Collaborating Using Pull Requests 1. Create a new branch for your feature or bugfix. 2. Make and commit changes. 3. Push your branch to the remote repository. 4. Create a pull request, describing your changes and requesting a review. ### Code Review Processes 1. Reviewers should provide constructive feedback on the pull request. 2. Address feedback and make necessary changes. 3. Once approved, merge the pull request into the develop branch. ## Git Cheat Sheet For quick reference, we've created a Git cheat sheet that summarizes essential Git commands and concepts: [Git Cheat Sheet](https://hackmd.io/@p5OlpL4oRzG8eesZdtTWvA/SkUuTrhA2)