GIT Development Workflow

From FirebugWiki
Revision as of 17:29, 30 January 2014 by Sebastianz (Talk | contribs) (Switched point four and five)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Recommended settings[edit]

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

  co = checkout
  ci = commit
  st = status
  br = branch
  hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short

General workflow[edit]

  1. Anything in the master branch is deployable
  2. To implement a new feature or bug fix create a new feature branch out of master
  3. Commit all your changes to the branch and push on the server
  4. When you need feedback/review/help, open a pull request
  5. After testing your branch by running Firebug test suite on it, merge it into master
  6. When doing a release create a tag/branch off of master

master branch[edit]

  • The master branch 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 master branch.

Wrong commit messages for fixes[edit]

If you accidentally added the wrong commit message to a patch for an issue:

  1. Revert your changes using git revert. Add the following message to the revert commit: "Backed out <commit hash> for wrong bug number/commit message"
  2. Reland your patch with the correct commit message.

Doing so avoids confusion when looking at blames/lists of commit messages.

Working on a feature[edit]

1. Create a feature branch[edit]

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

Create a new myfeature branch:

$ cd firebug
$ git checkout -b myfeature master

2. Commit to the feature branch[edit]

Commit all your changes into your feature branch and publish all to the public server (

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

3. Open a pull request[edit]

If you need somebody from the team to review your code, open a pull request.

4. Merge to master[edit]

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 myfeature

Get 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

Push to public server:

$ git push -u origin master

Don't forget to remove your feature branch after a successful merge. It's not needed anymore.

$ git branch -d myfeature

Delete myfeature branch on the origin remote:

$ git push origin :myfeature

Create a release branch/tag[edit]

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:

$ ./ 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.0a5

Push to public server:

$ git push -u origin master

Hot fixes[edit]

When there are issues that should be fixed in point releases you need to backport your patch to the branch for the previous release.

1. Create an issue[edit]

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.

2. Fix the bug[edit]

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.

3. Port the bug[edit]

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.

4. Mark the issue as ported[edit]

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>.