The master branch will always be at our last release. It is currently set to v1.3.0. @nvie calls this production-ready.
The develop branch will be the current working branch. This will be like how we treated master in the past, but with one additional requirement. We will expect this branch to be in a fairly usable state. For the time being, that means it passes all tests: test-unit, test-distributions, test-models.
In order to enforce the good state of the develop branch, all things that get into the develop branch will be done by pull requests.
Note: we are working on an honor system. The active developers will still have the ability to push to the develop and master branches.
Non-Permanent Branches
(quick description. Instructions further below.)
We will have 3 types of non-permanent branches:
Feature branches are the most common. Any type of new feature, fixing of bugs in a feature that hasn't been released, or pretty much any new development will go in a feature branch. These branch from "develop" and are named "feature/<some-descriptive-name>". After development is complete on the feature, submit a pull request back to "develop".
Hotfix branches are fixes to bugs in the current release. There should be an issue created for the bug in our issue tracker prior to branching. These branch from "master". These are named "hotfix/<next patch version number>". ONce the patch is complete, this will be merged into both "master" and "develop".
Release branches are branches for new releases. These branch from "develop" and are eventually merged into "master". Most developers won't need to worry about this step.
How to Contribute with a Clone of the Repository
(Most of us have been using the repository this way. Using this method, we can share feature branches with ease for collaboration.)
For a hotfix branch:
That's it. That's how it works.
How to Contribute with a Fork of the Repository (we should be using a clone)
(This is how some of us have been working. The downside: if you want others to help, you need to give people permissions to your personal fork of the stan repository.)
For a hotfix branch:
This is probably useless to say since is already warned in git 1.8, but I would recommend everybody that haven't already done it, to run the following:
git config --global push.default simple
This is to avoid the command git push origin to inadvertently push to all branches which could cause, for example, one to "update" master in case one has the old version of it.
After doing this, git push origin will only push to the current branch (this will be default for git 2+).
git config merge.ff false
Also, the attached file is a pre-push hook that should be saved at STAN_HOME/.git/hooks/pre-push (without any extension) and verify that its executable bit is set. This will prevent you from accidentally pushing to origin/master or origin/develop but requires git >= 1.8. Daniel and Bob might want to modify this hook so it merely asks "Are you sure you want to push to origin?" [y/n] and requires a confirmation.
I would strongly favor a rule that everyone with access to the Stan organization on GitHub install git 1.8 or greater so that you can do as Marco suggests. In addition, you want to do (inside STAN_HOME locally)
git config merge.ff false
This prevents fast-forward merges which are evil under the gitflow paradigm. I didn't add the --global flag in case you are using git in another project that tolerates fast-forward merges.
Thanks for the feedback.
Could you explain what a "merge bubble" is and why you
think it's bad?
I thought we wanted to keep track of the merges rather
than ever using fast forward. I hadn't thought about it
from the perspective of merging develop back into feature
branches.
Also, it seems that git pull --ff is able to overwrite this config.
> I had been presuming that we would rebase feature branches anyway.
>
I didn't get very well this point in the other discussions, is it better
to rebase all your commits to a single one before sending a pull
request? I think this is related to git bisect, right? But I never used
it so I don't know what is a desirable history.