Many people have different opinions on this subject.
The best according to me is to have a master branch which contain only deployable commits. Every commit on the master branch could potentially be deployed.
Every time you need to add a feature or fix a bug, create a branch, work on it and when you are ready to merge it back to master, do the following:
- Test your changes
- Rebase master on your feature branch
- Test your changes again
- Merge your branch into master without fast-forward
So that would look something like this:
$ ./run-some-tests $ git checkout MYBRANCH $ git rebase master $ ./run-some-tests $ git checkout master $ git merge --no-ff MYBRANCH $ git log --first-parent master # show only commits done on the master branch
That would allow the master branch to have a clean history.
I work as a freelancer, so if you don’t want to do that kind of things yourself or don’t have the time, just drop me a line to hire me.