GBS
|
This page explains the basic git workflow used in GBS to have a clean and easy development cycle
The firs step is to make sure that your git has the correct basic configuration, i.e. you have set up a username and an email address. This will ensure a clean history and allows one to quickly and easily identify you.
The basic configuration is done as follows
where FIRST_NAME
and LAST_NAME
, and your@email.address
have to be replaced with the correct information.
At any time, you can check your configuration using
--global
option by --local
.Keep in mind that the commit messages are often used in the debugging process to identify when and where a bug was introduced. It is then important to explain clearly and concisely what you have done in a commit.
Here are some rules to apply to all your commit messages:
For example:
Summarize changes in around 50 characters or less
More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as the
subject of the commit and the rest of the text as the body. The
blank line separating the summary from the body is critical (unless
you omit the body entirely); various tools likelog
,shortlog
andrebase
can get confused if you run the two together.Explain the problem that this commit is solving. Focus on why you
are making this change as opposed to how (the code explains that).
Are there side effects or other unintuitive consequences of this
change? Here's the place to explain them.Further paragraphs come after blank lines.
- Bullet points are okay, too
- Typically a hyphen or asterisk is used for the bullet, preceded
by a single space, with blank lines in between, but conventions
vary hereIf you use an issue tracker, put references to them at the bottom,
like this:Resolves: #123
See also: #456, #789
It may be useful to isolate your work from the master
branch to ensure that what your doing will not impact the production branch until it is fully tested. In git, it is very easy to do so by using the concept of branches. Here is a small summary on how to use them.
feature
branch (the name is arbitrary): feature
branch and all the work you will be doing is isolated from the master
branch. You can then develop the code without worrying about the tests, etc. master
that you want to incorporate into the feature
branch, you can use the merge command: master
branch to your feature
branch as soon as there is a push. This will, hopefully, avoid long and painful conflict resolutions.master
branch, you can merge it to the later: master
into your branch, the last merge should be executed without conflicts. --no-ff
option allows to keep a trace of the branch in the history which may be useful to track the developments. It is also important to symbolize that only the merge commit is ensured to be tested and stable.Use the following command to create an annotated tag with git:
where vX.Y.Z
is the new version of the code and <commit hash>
is the hash of the commit you want to tag. Note that the commit hash is not required if you currently have it checked out. The git tag
command will open a text editor and you will be asked to enter a meaningful message to describe the version.
git fetch origin
and then check the last tagged version with git tag -l v*
.Once the version has been created, push it to the server using
In GBS, we use a simplified variation of the GitFlow to maintain a clean and deployable master
branch that can be used for prodution at any time. The golden rules are the following:
feature
branch with an explicit name defining the current work. Typically, all the feature
branches are named following the convention feature/<feature_name>
e.g. feature/new_boundary_conditions
.With those two golden rules in mind, let us make a quick example for the development of a new Poisson solver.
master
branch into your feature
branch: master
branch and delete the feature branch: master
branch You may want to receive email notification for each push that occurs on the GBS repository. For this, you need to setup an Herald rule on c4science:
Herald
and select Herald: Create notification rules
Create Herald Rule
on the top right of thw window and select Commit Hook: Commit Content
and then Personal
Conditions
panel, select all of
, Repository
, is any of
, and rGBS GBS
Action
panel the selected action is Send me an email
and save the rule