Git Servers & Providers

Git Fundamentals for developers experienced in TFVC

TFVC (Team Foundation Version Control) is a centralized version control. Meaning there is a central repository from which we create a local working folder and keep the local folder in sync with the central repository. We check-in and check-out files in the central repository.

Git on the other hand is a distributed version control system. You don’t need a central repository to create a git repository. You can initiate a repository in any folder by calling command git-init in that folder on command prompt.

Git also works with central repositories called as remote repositories. However, all the local repositories always have a full copy of the repository and make it easy to work in an offline mode.

There is no explicit check-out process in Git. Git Commit is equivalent of Check-in of TFVC. However the Check-in process of Git is two step. First we commit the changes to local repo and then push those changes to remote repository. “Get latest version” command of TFVC can be compared with pull command of Git. We can also perform a sync operation which is a combination of Pull and then Push to the remote repository.

Two step vs single step process

In case of Git, files are not automatically added to local or remote repository. We need to explicitly add new files to the repository through commit. Also there is no need to push the commits (A term used for a group of files committed to local repo) immediately to the remote repository. We can club multiple commits in one push request.

Conflicts are resolved during push and pull operations. You can merge the conflicts but need to commit and push them again. This way there are separate records of original planned commit and merge. This is helpful in case of branching and merging.

Branching in TFVC and Git are different in nature. TFVC uses folder replica for branching. To change the branch, one needs to start working in different folder. However, Git always has one branch active within same folder. Once we change the branch, Git updates the local files to those in the new branch. So it is very important in Git to keep watch on current branch as one may accidentally do the changes in different branch. However, this makes switching branches in Git very easy.

Code Review on TFVC & Git

Code Reviews are conducted on TFVC by creating temporary check-ins called shelvesets. Developer creates the shelvset and shares it with the reviewer using a link/ id.

Git on other hand has a concept called pull request. Developer makes changes in his branch and creates a pull request on the branch where the changes are to be merged. The reviewer reviews the changes and either accepts or rejects the changes.

Git by default does not force to submit changes only through pull requests. However, git server products can enforce such policies on branches. In TFS we can set up branch policy to allow changes only through pull requests.