Git Workflow Model

TRELLIS loosely follows the Vincent Driessen model of Git workflow. Each repository follows a structure that contains two permanent branches, a Master branch and a Development branch. The Master branch contains the current source code that is published to customers. The Development branch contains the most recent successful build state across all developers. When there is a bug reported by a customer, a Hotfix branch is created, cloned from the Master branch. Hotfix branches should have an absolute minimum lifetime, created when the bug is reported and deleted after being merged into the Master and Development branches. Feature branches are created whenever a developer is attempting to create a new feature for the project. Feature branches are kept for as long as the feature remains in development, ie until is it merged into the Development branch or dropped.

Git Workflow

The boxes represent states of each branch. The connectors represent changes in those states. Where connectors connect different branches, they represent either a branch creation when the connector points to a new branch, or a merge when the connector points to an existing branch. Connectors between branches are labelled with the reason for the branches creation.

Creating a Git Repository
Step 1: Creating the repository

When you sign in to the team website, click on the “Code” tab at the top of the screen.

Creating a Git Repository

You will be navigated to the code screen where it will show you the details of your most recently viewed repository and the code inside it. Left click on the name of the repository in the top left and select “New Repository.”

Creating a Git Repository
Creating a Git Repository

Enter the name of the repository into the Repository Name field and click on the checkbox to add a README file to the repository. Finally, add a “VisualStudio” gitignore file from the gitignore dropdown selection. The dropdown can be filtered by typing into it. The gitignore file is important because it prevents Visual Studio from attempting to commit unnecessary files to the repository, which causes errors. Finally, click the “Create” button. The repository will be created with an empty README file and a gitignore file that ignores Visual Studio base files. The repository is created with a “Master” branch.

Creating a Git Repository
Step 2: Connecting to and cloning the repository

An Extensions repository has been created, currently containing only a README and a gitignore file. To connect to it, open Visual Studio and open the Team Explorer. Click on the "Connections" icon, then click “Manage connections” and select “Connect to a project.” Select the new repository from the menu and click the “Clone” button at the bottom of the window. This will clone the repository from the server and allow you to make changes.

Connecting to the repository
Connecting to the repository
Connecting to the repository
Step 3: Creating a project within the repository

Open the File menu and select "Create New Project" as normal. For the project type, select ".NET Standard Class Library." Enter the name of the project and select “OK." Creating a repository on this screen will create a local repository, which is unable to connect to the database and commit to shared repositories.

Create Project
Step 4: Committing to the repository

There are two parts to committing to a repository in Visual Studio. The first part is staging your changes and committing them locally. At this point, the changes are held in a commit stage on your local PC, but have not been committed to the shared repository online. The second part is where you commit the changes to the shared repository.

Committing to the repository
Committing to the repository

For part one, open the “Changes” menu in the Team Explorer. Select the “+” button in the Changes section to stage all the changes. Git requires that you add a comment to all Commits. Summarize your changes in the comment and select “Commit All.” Alternatively, you can open the drop-down menu and select “Commit All and Sync,” which executes a sync operation automatically.

Committing to the repository

For the second part, select the “Sync” option in the Team Explorer home menu. From here, you must first pull any incoming commits and resolve any conflicts before you push your own changes to the repository. All commits are made to a branch. If no other branches have been created or selected, the commit is made to the “Master” branch.