All development is assumed to be done on a Mac running a modern version of OS X but ought to be pretty much the same no matter what unixy environment you use.
All development is to follow the standard git-flow process, modified to allow for code-reviews.
See this handy, if ugly, cheat sheet.
- 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
main
branchgit checkout -b main
and test it viagit pull upstream main
- ensure you have installed the
git-flow
command line helpers andgit-flow-completion
utils then rungit 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. Then paste the url of the PR into the
#development
Slack channel with a request for someone to please review the changes. See below for how to name pull requests. - 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 someone else then merge the PR. Note we will not be using 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/{branch_name}
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 main 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 intomain
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 main from your fork's
main
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 localmain
anddevelop
branches to ensure everything on your local machine is up to date with everyone's changes.
Note you will 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 changeOptimisation
- The change is an optimisation of the code base without any functional changes
If your change does not fit any of these categories, use Feature
. Likewise if your change is not tied to an issue number you may use n/a
instead.
So to use the above example your Pull Request would be named [Feature, ABC-1] added anteater to aardvark
A developer must be responsible for their own work, from accepting a task through to merging to production. With that in mind if you review another developer's PR, please don't then merge it yourself. As a general rule you must let the developer merge her own PRs.
Likewise, don't expect someone else to merge your PR. Unless you do not have write permission on a project, you will always aim to take personal responsibility for the quality of the code that gets merged in.