The workflow has to at least fulfill the following requirements.
UniGeSPC/Palabos
, in order to automatically merge the branch.UniGeSPC/palabos
as a public repository under the namespace AA/palabos
into namespace B as B/palabos
as a private repository.There are four kinds of branches:
The master branch is simply used to save a copy of the UniGeSPC/palabos/master. Whenever this is a new release/update from the upstream, it should be merged to the master branch which is then merged to the develop branch.
As our own Palabos project is forked from the UniGeSPC/palabos, when we first clone the GitLab repository, our master branch should be synchronized with the UniGeSPC/palabos/master.
In order to track the official Palabos project, we need to add the UniGeSPC/palabos as the upstream 1
$ git remote add upstream https://gitlab.com/unigespc/palabos.git
1
$ git remote -v
git fetch
, it only fetches the master branch instead of all branches. 1
2
3[remote "upstream"]
url = https://gitlab.com/unigespc/palabos.git
fetch = +refs/heads/master:refs/remotes/upstream/master
When there is a new release in the upstream, fetch it and merge it into master 1
2
3
4$ git fetch upstream master
$ git checkout master
$ git merge upstream/master
$ git push origin master1
2
3$ git checkout develop
$ git merge --no-ff master
$ git push origin develop
The develop branch is used for the development, including new features or algorithms. It is initially branched off from the master branch 1
$ git checkout -b develop master
However, it may never be merged back to master. Instead, whenever master gets an update from the upstream, it should be merged to develop branch. 1
2
3$ git checkout develop
$ git merge --no-ff master
$ git push origin develop--no-ff
to avoid fast-forward merge.
The --no-ff flag causes the merge to always create a new commit object, even if the merge could be performed with a fast-forward. This avoids losing information about the historical existence of a feature branch and groups together all commits that together added the feature.
The feature branch is used for both algorithm implementations and new functions/dataProcessors. It can be used for implementing both published and unpublished algorithms. The feature branch has a name convention feature-*. Whenever starting a new feature, it should be branched off from either the master branch or the develop branch.
When you want to implement an algorithm that would be contributed to the upstream Palabos repository, you should branch off the master branch: 1
$ git checkout -b feature-DESCRIPTION master
1
$ git checkout -b feature-DESCRIPTION develop
When the development of a new feature is done and tested, it should be merged to the develop branch. 1
2
3$ git checkout develop
$ git merge --no-ff feature-DESCRIPTION
$ git push origin develop
If you want to contribute this new feature to Palabos, you can create a merge request
.
You can also delete this branch once it is merged to both the develop branch and the official Palabos. 1
$ git branch -d feature-DESCRIPTION
bugFix is used to fix bugs. It is suggested to open an issue for each bug your find. It could then be branched off from develop 1
$ git checkout -b bugFix-issueX develop
1
2
3$ git checkout develop
$ git merge --no-ff bugFix-issueX
$ git push origin developmerge request
for your bugFix branch. If this happens, you might have to solve the conflict manually when you fetch upstream/master into the local master and then merged to the develop.
The palabos repository has CI/CD to make it easier for integrating and testing the codes from different contributors. In general:
.gitlab-ci.yml
. You can find it in the palabos root directory..gitlab-ci.yml
defines the pipelines to be done.I am totally new to CI/CD but only few things we need to do in order to make a successful merge request:
Generally, this framework should work for most of our daily development and usage based on Palabos. My main doubt now is about the master branch. As it does nothing but saving a copy of the upstream, it seems reasonablbe to remove it. Everytime we see an new release from the upstream, the upstream/master could be directly merged in to the develop branch. However, the master branch is still kept for now to make the structure clearer.
Even though the workflow is not perfect, it allows us to maintain a customized Palabos while keeping the repository up-to-date with the upstream official Palabos. It is also easy to contribute to Palabos if you want. The flow diagram showed at the beginning is made based on Vincent Driessen's template. Don't be hesitate to leave a message if you have any comments or suggestions. Thank you.