Welcome to the DHIS 2 wiki pages.
The dhis2-core
repository contains the following branches.
master
branch represents the snapshot / latest development branch. Master receives commits through pull requests from feature branches and maintenance branches.2.24
. soft-deletes
.lars-dhis2-core
.This section covers the regular development workflow.
Create a branch for development work. Feature branches should be created for substantial features. Give the branch a descriptive name, e.g. soft-data-value-deletes
. Maintenance branches should be created for minor tweaks and cleanup. Give the branch a name on the format {dev-name}-dhis2-core, e.g. lars-dhis2-core
.
Do development work in the respective branch.
Publish your branch. This can be done by a) pushing your branch into the main dhis2-core branch or b) push it as a separate forked repository under your personal account.
Open a pull request for your feature or fix. Provide the pull request with a descriptive message.
Ensure that tests are passing.
Optionally, request peer review of your pull request from another core developer.
Merge the pull request into master. For feature branches, do a squash merge, where a single commit is merged into master representing the entire feature. For maintenance branches you can potentially do an "expanded" commit where each individual commits are merged into master. In that case, ensure that each commit has a descriptive commit message.
The following git commands are useful in the regular development workflow.
git branch
git pull
git branch soft-deletes
git checkout soft-deletes
git status
git diff
git add -A
or git add {name-of-file-or-dir}
git push origin soft-deletes
git checkout master
When it is time to commit, supply a descriptive commit message with less than 70 characters. To add an additional description, supply a line break after the message and then the description. This can be done by using single-quotes and line breaks on the command line and will look like this:
git commit -m 'Implemented super fast aggregation
> Enabled turbo boost switch in database.'
After working locally on a branch you might want to squash multiple commits, i.e. combine into one. If you have e.g. two commits that you want combine into one you can do:
git rebase -i HEAD~2
On the screen that appears, leave the first line with pick
as it is, then on the second line change pick
to squash
and save. On the next screen, edit your commit message and save. You can now merge your commit to another branch or push to remote.
This section describes the workflow for back-porting bug-fixes and tweaks to stable branches.
git checkout 2.24
git fetch
git pull
git cherry-pick -x {hash}
, the hash will look something like c3c1ede6cfd1f47f30490abfbdca622db1ef6259
. The -x
option appends cherry-picked from ...
to the commit message.git push origin 2.24