Introducing a "successful git branching model" step by step

So, I started to implement this model .

I am completely new to Git and the software implementation process, so I have listed everything that I have done so far. I need your help with some question that I have, and maybe some recommendations if you see that I do not understand something or are not moving in the wrong direction. I believe that this can be a great help for those who embark on this path. So here is what I have done so far. I have the following structure for my site.

/var/www/mysite.com/ kohana kohana files www index.php other files 

To implement the model, I did the following:

  • I initialized the repository to clone the open repository and made an initial commit:

     cd /var/www/mysite/ git init git add . git commit - 'initial commit' 
  • I added a general user to put the "central repo" (shared open repository) inside:

     - adduser git - su git - cd 
  • I cloned the repository to this user folder. This will be the origin repository.

     git clone --bare /var/www/mysite.com mysite.git; cd mysite.git; 
  • I added a second main branch to “evolve”, and now there is a master host of two branches:

     git branch develop; git branch -a *master develop 
  • I added users who will develop the product:

     adduser maximus adduser len4ik 
  • I created ssh keys for them and placed them in .ssh directories:

     su maximus; mkdir .ssh; cd ~/.ssh; ssh-keygen -t rsa -C " maximus@example.com "; su len4ik; mkdir .ssh; cd ~/.ssh; ssh-keygen -t rsa -C " len4ik@example.com "; 
  • I created public repositories for each of them.

     su maximus; cd; git clone /home/git/mysite.git; su len4ik; cd; git clone /home/git/mysite.git; 

Now my developers will install TortoiseGit on Windows, configure the ssh keys and pull them from their public repositories into repositories created locally with TortoiseGit on Windows.

I have a few questions:

  • In step 4, which branch should be selected? Now this is a "master", but I need to switch it to "development", maybe?
  • I assume that users will push and pull them out of their public repositories ( /home/user/mysite ). How do their commits end in a "central repo" that is /home/git/mysite.git ?
  • How can these users check branches and get updates from the "central repo"?
  • At what point do I need to create realease and function branches? Do I need to create them on a "central repo" ( /home/git/mysite.git )?
+4
source share
1 answer

1) You can choose any branch on which you want to develop - it can be a master or develop. I would recommend trunk / master-branch-based development (in this case, I would suggest deleting the development branch itself).

2) Users will have to configure their version of the wizard to track your repo (in this case, git can act just like any other SCM without Dvcs, i.e. has a central repo where each committer pushes / pulls out). By setting this next / tracking, they can click on "remote".

3) Same as above, they can pull / push away from the remote / central repo.

4) If you follow the continuous delivery / deployment model, you do not need feature and release branches. If not, then I would suggest a branch for each release. Functional branches can be executed, but preferably should be short-lived. In this case, the main [branch] is indeed the main [copy of your code base].

0
source

Source: https://habr.com/ru/post/1493397/


All Articles