Michael Mahony
Michael Mahony

Reputation: 1350

Setting up GIT branches properly for development of application

I have never been in the position I am now and I am being asked to manage the GIT repositories for our project. While I know that there is no single "correct way" to do this, I was provided the following article about the most successful git branching model

I want to follow this workflow, so for our project we want the following branches:

master (contains the code currently running on our production environment) staging (contains the code currently running on our staging environment) development (contains the code that always reflects a state with the latest delivered development changes for the next release)

Our process will involve each developer being assigned tasks during a sprint cycle. Each developer will create a feature branch for their work that is cloned from the development branch. They will do the work required and when it is complete they will merge their branch into the development branch.

We are using GIT running on TFS.

My assumption (and this is what I need confirmed) is that I should create one main repository in TFS--let's call it JBenchView. After that I will have a master branch. I now need to create the development and staging branches within that same repository. This is what leads to the following questions.

  1. Is my understanding correct above?
  2. How do I create the development and staging branches so that they show up IN TFS under the repository? What is the step by step process for creating these branches (ie. do I clone Master then create a branch off of master using git checkout -b branchName or is there a faster/easier way)?
  3. Is there actually a way to create these branches inside of TFS?
  4. We tried a failed approach and it appears that one developer was creating his feature branches using GIT bash and the other was creating his feature branches using Visual Studio. The feature branches created by the developer who used GIT bash show in the repository, but the branches created using Visual Studio do not. Why is that and how can that be fixed going forward?

Upvotes: 1

Views: 65

Answers (1)

Philippe
Philippe

Reputation: 31207

If you want to do all that from the command line, you could install the gitflow scripts that will simplify the steps. There is also an extension to do it in Visual studio.

You could also use GitExtensions that have a plugin to do it (that I wrote ;-)).

But if you adopt such a complex workflow, especially for new git users, create the branches only when you need it and refrain to create the branches before that.

For the 4th point, the difference is surely that the developer in visual studio didn't pushed its newly created branch!

PS: I do not recommend to use git in visual studio, especially for beginners because the GUI is very confusing...

PS2: I do not recommend to begin straight on with the gitflow, except if you REALLY need it. You should take time to understand the aim of each type of branch. Have a look to the github flow for a beginning...

Upvotes: 2

Related Questions