Skip to content

GitHub from Visual Studio 2015

BorjaFG edited this page Mar 30, 2017 · 6 revisions

Branch-based workflow

Each collaborator will work on a project, which will have issues (they may be bugs or features to be added) and notes (which are more generic descriptions of a feature). These tasks need to be done before the project is finished and they will be moved in the project from "TODO" to "In progress", then to "Testing", then to "Finished". Going from "Testing" to "In progress" is, of course, an option. Issues may be assigned to a certain collaborator or the may be marked as help-wanted. These issues will be named using the following convention: first the name of the application the issue belongs to, a colon, and then, a short description. For example: "Badger: add a button in the report viewer to save all the reports". Inside the issue, a description will be added. Before starting on an issue, the collaborator will assign (if it has not already been assigned by the project owner) it to himself, letting the rest of collaborators know who is working on what. Each task (issue/feature) will be done in branch off the "develop" branch. The name of the branch may be a very short description of its goal (i.e, "badger-add-save-button") if more than one person is going to work on it, or include the assignee's name before the description (i.e, "dan-simmons-badger-add-save-button"). When a feature is finished (after testing the feature itself and making sure all the projects within the solution compile), then the feature's branch is merged with the "develop" branch (Team explorer->select develop branch->merge from->{my branch}). More info on how to use branches can be found here.

Basic steps

Visual Studio - Team Explorer

Connections to repositories and code versioning is done in the Team Explorer tab. Use the arrows in upper left corner to navigate the different views: Changes, Sync, ...

Team explorer

Clone the repository

First, we need to download a copy of the remote repository. This copy will have a reference to the remote server so that both repositories can be synchronized later. We can clone the repository from github.com using a web client:

Clone from a web client

or using Visual Studio\Team Explorer:

Clone from Visual Studio

After cloning it, we can open the solution file (.sln) and browse the source code.

Branches

A branch is an isolated version of the copy where we can program without interfering with other developers. The main branch is called _main. We only want stable versions of the code in this branch, those which can be downloaded in GitHub/Releases. From this main branch hangs the development branch (develop), where we only should have versions of the code that compile correctly. Instead of working directly on this branch, each developer will create its own branch hanging from develop, where the developer can work on a feature. When the feature is finished (please compile all the projects and run all the tests), the branch can be merged back with develop.

Creating our own branch

To create our own branch in Visual Studio:

Create branch

Making changes

After creating our own branch, we start making changes to the code. Then, after some time, we will want to commit our changes. We commit our changes ("Commit All")against the local repository providing a description of what we have done:

Commit changes

Note: commit changes often, since we will only be able to go back to committed code. Uncommitted code won't be available anymore.

Sync local and remote repositories

Whenever we want to upload our changes to the server and download remote changes (remote changes should be in a different branch most of the time so they shouldn't interfere with our work) we sync repositories:

Sync changes

Clone this wiki locally