All development should follow the standard git-flow process, modified to allow for code-reviews.
For reference on git-flow commands, check out this cheat sheet.
- if not done already, install git flow.
- fork this repo into your personal GitHub account
- clone your fork to your local development machine
- set this repo as the
upstream
repogit remote add upstream <insert the upstream url>
- disallow direct pushing to upstream
git remote set-url --push upstream no_push
- create a local
master
branchgit checkout -b master
and test it viagit pull upstream master
- run
git flow init -d
Set up git
to always rebase
rather than merge.
git config --global branch.autosetuprebase always
Make sure git
knows you are using your correct email.
git config user.email "[email protected]"
- Create a "feature branch" for the change you wish to make via
git flow feature start {feature_name}
. See below for how to name features. - Now work on your changes locally until you are happy the issue is resolved. See below for how to name commit messages.
git flow feature publish {feature_name}
will push it back up to your fork on GitHub.- Use
git flow feature pull {remote_name} {feature_name}
to bring in any other changes, If other people have also merged changes in, and you can't merge your PR automatically you'll need torebase
their changes into your changes and then--force
push the resulting changes using standardgit
commands. - Use GitHub to raise a Pull Request. Add labels as appropriate, and set one or more reviewers if necessary. Then share the PR link in the proper channels to request for reviews.
- Respond to any comments as appropriate, making changes and
git push
ing further changes as appropriate. - When all comments are dealt and the PR finally gets a 👍 from the reviewers then merge the PR. Note this scheme does not use the
git flow feature finish
option as that merges into develop automatically without the option for review. see this stackexchange for more on that. - In your command-line
git checkout develop
thengit pull upstream develop
to get the latest code andgit branch -D feature/{branchname}
to delete the old feature branch.
It's basically the same process but use the word hotfix
or support
instead of feature
. git flow
knows what to do. Just keep in mind that any changes are going to happen to your fork, and not the upstream repo. If you need to merge a hotfix
into upstream master you may only do it va a reviewed pull request.
git flow release start {tag.number}
(using semantic versioning)- commit any changes to version info in
package.json
thengit flow release publish {tag.number}
git flow release finish {tag.number}
merges the release intomaster
of your fork, tags it, merges that back intodevelop
on your fork and removes the release branch.- Now go back to GitHub and raise a Pull Request to merge the upstream master from your fork's
master
branch. When that goes through you are done. - In your command-line go back and clean up any outstanding branches and
git pull upstream
your localmaster
anddevelop
branches to ensure everything on your local machine is up to date with everyone's changes.
Note you should never push changes directly to the upstream project, only to your own fork.
Changes may only be introduced into the upstream project via a properly reviewed pull request.
There are various systems, including GitHub itself, which will pick up the issue numbers from commit messages and pull requests and automatically associate them with the issues. It is therefore desirable to use a formal naming scheme for features, commit messages and pull requests.
Features must be named per the following pattern #{issue number}/{some_descriptive-text}
— so for example, if you are working on issue ABC-1
with the title "do the thing", call your feature ABC-1/do_the-thing
. Obviously use your common sense to avoid making the feature names too long.
Note this will creating a feature via git flow
will create a branch called feature/{issue number}/{some_descriptive-text}
.
When commiting something use the -m
flag to add a short commit message of the format {issue number} summary of what you changed
. So for example if you are working on issue ABC-1
and you added a method to the aardvark_controller
you might use the following commit message "ABC-1 added anteater method to aardvark controller"
Commit messages ought to be in the past tense.
In general try to group file changes wherever appropriate, so if your controller change also involved updating something in a helper file, the one commit message can happily encompas the changes to both files. The message ought to reflect the main aim of the change.
Pull requests must be named as follows [issue type, issue number] high level description of change
. The following Issue Types are recognised
Bug Fix
- the change fixes a bugFeature
- the change adds a new feature (the usual issue type)Documentation
— The change is a documentation only change
Other categories might be defined according to each project specific needs.
Example:
[Feature, ABC-1] added important method to main contract.
All PRs including changes in code should address the related functionalities through proper unit testing. Ideally, code coverage should be kept at 100%.