Workflow - Yoni19/PyramidRace-React GitHub Wiki
Workflow
Protected branches: develop and master
The main idea is to keep the master
branch clean and functional, even if not completely up to date. No commits are made to master
and pull requests should only be made from the develop
branch. This branch is protected and needs 2 reviewers before a merge can be made.
In this project, the develop
branch is set as the default branch, so any pull requests default to develop
. This branch is intended to be more up to date, even if any merge should be made through a pull request, reviews are only suggested and not mandatory.
Feature branches
Feature branches should be made from and up to date develop
, and when the feature is ready a pull request to develop can be made.
hotfix and release branches
When a bug reached master
it is necessary to create a new branch from master
, fix the bug, and merge this hotfix branch directly to master and develop.
It is also possible to define release
branches, between develop
and master
. The idea is to freeze new functionalities from a current develop
and include only bug fixes (no new features).
OK... What do I type? Where do I click?
develop and master branches
master
and develop
branches should be automatically synchronized with heroku.
To create the develop
branch from master (-b
for new branch, origin
is the default name of a remote):
git checkout -b develop
git push -u origin develop
Using a feature branch
First step is always to make sure our local develop
branch is up to date:
git checkout develop
git pull
Then a feature branch can be created:
git checkout -b devise-for-owners
Work can be done in this feature branch with regular commits and pushes:
git push -u devise-for-owners
[work]
git add . && git commit -m "Owner model with devise" && git push
[work]
git add . && git commit -m "Navbar links updated" && git push
...
From times to times, and especially before creating a pull request, it is necessary to keep track of any upstream changes in develop
:
git checkout develop
git pull # There should be no conflicts
git checkout add-devise
git merge develop # Conflicts can happen here and should be fixed
Testing in prod
Each contributor should deploy its own heroku app
heroku create my-own-happy-minute
And set all config variables (ENV) with:
heroku config set ENV_VAR="value"
And push the feature branch to heroku to test before PR (the easiest way is to go to the Deploy tab on your heroku dashboard and select the specific branch you are working on). Because git push heroku branch
will only trigger build on branch master or main.