GIT Development Workflow
From FirebugWiki
Contents |
[edit] Recommended settings
Recommended settings in your .gitconfig file:
Entire Firebug repository should use Unix line endings.
- Windows:
git config --global core.autocrlf true git config --global core.safecrlf false
- Linux:
git config --global core.autocrlf input git config --global core.safecrlf false
It's also useful to have the following aliases defined in your .gitconfig
[alias] co = checkout ci = commit st = status br = branch hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
[edit] General workflow
- Anything in the
masterbranch is deployable - To implement a new feature or bug fix create a new feature branch out of
master - Commit all your changes to the branch and push on the server
- When you need feedback/review/help, open a pull request
- After testing your branch by running Firebug test suite on it, merge it into
master - When doing a release create a tag/branch off of
master
[edit] master branch
- The
masterbranch should be stable. - It should be always safe to make a release from it.
- If you push changes into master, they must be tested by Firebug automated test suite and all tests must pass.
- You should feel guilty if you break the
masterbranch.
[edit] Wrong commit messages for fixes
If you accidentally added the wrong commit message to a patch for an issue:
- Revert your changes using
git revert. Add the following message to the revert commit:"Backed out <commit hash> for wrong bug number/commit message" - Reland your patch with the correct commit message.
Doing so avoids confusion when looking at blames/lists of commit messages.
[edit] Working on a feature
[edit] 1. Create a feature branch
When you work on a new feature (or fix a bug), create a new feature branch named after the feature or the issue number it represents.
First clone the Firebug repo:
$ git clone git@github.com:firebug/firebug.git
Create a new myfeature branch:
$ cd firebug $ git checkout -b myfeature master
[edit] 2. Commit to the feature branch
Commit all your changes into your feature branch and publish all to the public server (github.com).
Commit to myfeature branch.
$ git add <modified-file> $ git commit -m "This is my new feature"
Push to public server into myfeature branch:
$ git push -u origin myfeature
[edit] 3. Open a pull request
If you need somebody from the team to review your code, open a pull request.
[edit] 4. Merge to master
After you are done with your changes you can merge your branch back to master. Since master could have changed in the meantime you should update your branch before merging and solve any possible conflicts.
Switch into myfeature branch:
$ git checkout myfeatureGet changes from master. Using rebase here will cause git to pull off the branch commits, update the branch to master, then re-apply the commits. Conflicts are easier to fix in this direction than with a merge.
$ git fetch $ git rebase master
Solve any possible conflicts and run Firebug test suite then merge to master.
$ git checkout master $ git merge --no-ff myfeature
Don't forget to remove your feature branch after a successful merge. It's not needed anymore.
$ git branch -d myfeature
Push to public server:
$ git push -u origin master
Delete myfeature branch on the origin remote:
$ git push origin :myfeature[edit] Create a release branch/tag
When doing a minor (alpha or beta) release, create a tag at the appropriate revision that bumps up the version number. In the case of a major (final) release create a branch (e.g. firebug1.11).
Create minor version tag:
$ ./bump-version.sh 1.10.0a5 $ git commit -a -m "[firebug-1.11.0a5]" $ git tag 1.11.0a5 $ git push --tags
Create major version branch:
$ git checkout branch firebug-1.11.0a5Push to public server:
$ git push -u origin master
[edit] Hot fixes
When there are issues that should be fixed in point releases you need to backport your patch to the branch for the previous release.
[edit] 1. Create an issue
If there is no issue for the bug yet, create an issue for it, so it can be tracked. Mark the issue with the label port-<previous Firebug version>, so e.g. port-1.11.
[edit] 2. Fix the bug
Make the necessary changes for the bug and commit your changes to the master branch. Mark the issue with the status Commit and set yourself as owner as you normally do.
[edit] 3. Port the bug
To fix the bug for the next point release you need to port it to the other branch. To do so switch to the version branch, cherry-pick the patch to it and push your changes to the branch.
[edit] 4. Mark the issue as ported
When you ported the patch don't forget to mark the issue as ported. To do so change the port-<previous Firebug version> label to ported-<previous Firebug version>.