equipes:devteam:gitflow

LIPN Git-flow guide

At #LipnDevTeam we follow the gitflow protocol

Install git-flow first

snippet.bash
$ sudo apt install git-flow

And then get into de repository you will work from

snippet.bash
$ cd code/javascript/plugins/publications

You can initialize git-flow if it is the first time you are using it into that Git repository:

$ git flow init

You will have to anser some questions (try to use default values) The process for fixing bugs or adding new features to an existing #LipnDevTeam system is as follows:

  1. You pull the develop branch
  2. You create a new branch for the new feature of bugfix you are working in
  3. You make the necessary commits and pushes until your bugfix/feature works as wished
  4. You publish the branch
  5. You make a merge request to the developbranch at the LIPN's Gitlab interface.
  6. If everything works Ok in develop, we go through stagging

Before start working, checkout and pull the develop branch from our Gitlab. You might pull other services your module depends from. For instance, if I'm working with the publications plugin, I may want to pull user_management plugin (which is outside the publications repository, at the plugins level).

$ git checkout develop
$ git pull

If you are fixing a bug from a project of LIPN's gitlab, you should first create a special Git branch for the bug you are fixing. This can be done with git flow. You just have to type from the command line:

snippet.bash
$ git flow bugfix start bug31_bibtex_import

You should get the following answer from git flow:

snippet.javascript
Branches 'develop' and 'origin/develop' have diverged.
And local branch 'develop' is ahead of 'origin/develop'.
Basculement sur la nouvelle branche 'bugfix/bug31_bibtex_import'
 
Summary of actions:
- A new branch 'bugfix/bug31_bibtex_import' was created, based on 'develop'
- You are now on branch 'bugfix/bug31_bibtex_import'
 
Now, start committing on your bugfix. When done, use:
 
     git flow bugfix publish bug31_bibtex_import

This will create a new branch called bugfix31_bibtex_import and switch your git to it. Afterwards you can commit and push as usual until you bug has been fixed.

When you are ready to merge with develop, you type:

snippet.bash
$ git flow bugfix publish bug31_bibtex_import

Of course, instead of bug31_bibtex_import you will type the name of the bug you are fixing. You should get the following result, if everything works fine:

snippet.bash
Énumération des objets: 26, fait.
Décompte des objets: 100% (26/26), fait.
Compression par delta en utilisant jusqu'à 8 fils d'exécution
Compression des objets: 100% (20/20), fait.
Écriture des objets: 100% (20/20), 1.90 Kio | 973.00 Kio/s, fait.
Total 20 (delta 16), réutilisés 0 (delta 0)
remote: 
remote: To create a merge request for bugfix/bug31_bibtex_import, visit:
remote:   https://depot.lipn.univ-paris13.fr/etamine/plugins/publications/-/merge_requests/new?merge_request%5Bsource_branch%5D=bugfix%2Fbug31_bibtex_import_jorge
remote: 
To depot.lipn.univ-paris13.fr:etamine/plugins/publications.git
 * [new branch]      bugfix/bug31_bibtex_import -> bugfix/bug31_bibtex_import
La branche 'bugfix/bug31_bibtex_import' est paramétrée pour suivre la branche distante 'bugfix/bug31_bibtex_import' depuis 'origin'.
Déjà sur 'bugfix/bug31_bibtex_import'
Votre branche est à jour avec 'origin/bugfix/bug31_bibtex_import'.
 
Summary of actions:
- The remote branch 'bugfix/bug31_bibtex_import' was created or updated
- The local branch 'bugfix/bug31_bibtex_import' was configured to track the remote branch
- You are now on branch 'bugfix/bug31_bibtex_import'

Finally, you have to open the URL indicated after the “To create a merge request for bugfix/bug31bibteximport, visit:” message and request that your branch is merged with develop.

If instead or fixing a bug you want to add a new feature, you just need to follow the same method, replacing the bugfix keyword for feature in every one of the above git flow commands.

If you want to continue with the next bug before the merge has been realized, you need to checkout develop again, and then restart the whole flow. When you go to the git lab to make the merge request of your branch, you have to pay attention to ask for a merge with develop branch:

  • Dernière modification: il y a 2 ans