Git Capabilities and Visual Studio Support

Git Storage

Git is a Decentralized Version Control System, meaning that there is no single data repository. Instead, each machine that connects to the primary git repository stores a copy of the repository. Git storage is structured so that the primary online repository contains one copy of the latest committed version of each file, and a .git file that stores the committed version history and branch information. Each repository stores each file only once, but can load and display any committed file version on command.


Commits are a stored set of changes made to a branch of the repository. Changes are made to a branch of the repository locally, then staged and added to a local commit. When a commit is made, a commit hash is randomly generated and assigned to it. The .git file in the repository stores information on branches and file history by relating change sets to their commits and comparing those to the most recently stored versions of the files in the repository.


Branching is a way to make simultaneous edits to a single repository without interfering with or causing failures in the Master branch. Branch data is stored in the .git file in the local repository. Visual Studio and Visual Studio Team Services use the data stored in the .git file to load the correct versions of each file required for the branch. To create a new branch, either a currently active branch is cloned, or a new branch is created. TRELLIS repositories contain two branches, a Master branch and a Development branch, as default.


Merging allows users to combine all the changes from one branch to another target branch. Once the merge is complete, both branches will be identical until more changes are made. A merge in Visual Studio must be initiated while the user is on the target branch. This is because Visual Studio only allows users to commit changes to a branch while the user has it set as their active branch. The user then selects the branch that they want to merge into their target branch. The merge is executed with any conflicts being resolved by the user.


Rebasing is a slightly different form of merging. Rather than combining changes from two different branches, it sets the origin branch to the most current version of a different branch, then applies the changes that were made to that. So, instead of branches A and B being merged to create branch C, instead branch A becomes the origin of B, and B's modifications are made using A as a base.


Git submodules are a form of functionality that allow a repository to be referenced by another repository and included in a build. Unfortunately, Visual Studio does not allow full functionality for submodules, classifying them as repositories in their own rights. This prevents users from linking submodules while using the team explorer interface, forcing the user to use command line Git for all subsequent commits to that submodule and the linked repository. We sincerely hope that Visual Studio will increase their submodule support following Microsoft’s acquisition of Git.


Visual Studio Team Services includes a method of setting up automated build releases. These releases can be made via a schedule or whenever a commit is made to a specific branch. Builds can currently only be used with a single Git repository as its data source.