GIT Development Workflow
From FirebugWiki
(→5. Merge to Master) |
Sebastianz (Talk | contribs) (Fixed spelling and formatting) |
||
| Line 1: | Line 1: | ||
| - | == General | + | == General workflow == |
# Anything in the <code>master</code> branch is deployable | # Anything in the <code>master</code> branch is deployable | ||
| - | # To implement a new | + | # To implement a new feature or bug fix create a new feature branch out of <code>master</code> |
# Commit all your changes to the branch and push on the server | # Commit all your changes to the branch and push on the server | ||
| - | # When you need feedback/review/help open a pull request | + | # When you need feedback/review/help, open a pull request |
# After testing your branch by running Firebug test suite on it, merge it into <code>master</code> | # After testing your branch by running Firebug test suite on it, merge it into <code>master</code> | ||
# When doing a release create a tag/branch off of <code>master</code> | # When doing a release create a tag/branch off of <code>master</code> | ||
| - | === 1. | + | === 1. <code>master</code> branch === |
| - | * The master branch should be stable. | + | * The <code>master</code> branch should be stable. |
* It should be always safe to make a release from it. | * 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. | + | * 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 <code>master</code> branch. | * You should feel guilty if you break the <code>master</code> branch. | ||
| - | === 2. Create | + | === 2. Create a feature branch === |
| - | When you work on a new feature (or | + | 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 Firebug repo: | + | First clone the Firebug repo: |
<syntaxHighlight lang="bash"> | <syntaxHighlight lang="bash"> | ||
$ git clone git@github.com:firebug/firebug.git | $ git clone git@github.com:firebug/firebug.git | ||
| Line 28: | Line 28: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
| - | === 3. Commit to | + | === 3. Commit to the feature branch === |
Commit all your changes into your feature branch and publish all to the public server ([http://github.com github.com]). | Commit all your changes into your feature branch and publish all to the public server ([http://github.com github.com]). | ||
| Line 42: | Line 42: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
| - | === 4. Open a | + | === 4. Open a pull request === |
| - | If you need somebody from the team to review your code [http://help.github.com/send-pull-requests/ open a pull request]. | + | If you need somebody from the team to review your code, [http://help.github.com/send-pull-requests/ open a pull request]. |
| - | + | === 5. Merge to <code>master</code> === | |
| - | + | After you are done with your changes you can merge your branch back to <code>master</code>. Since <code>master</code> could have changed in the meantime you should update your branch before merging and solve any possible conflicts. | |
| - | === 5. Merge to | + | |
| - | 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 | + | |
Switch into <code>myfeature</code> branch: | Switch into <code>myfeature</code> branch: | ||
| Line 56: | Line 53: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
| - | Get changes from master. Using rebase here will cause git to pull off the branch commits, | + | Get changes from <code>master</code>. Using rebase here will cause git to pull off the branch commits, update the branch to <code>master</code>, then re-apply the commits. Conflicts are easier to fix in this direction than with a merge. |
| - | update the branch to master, then re-apply the commits. Conflicts are easier to fix in this direction | + | |
| - | than with merge. | + | |
<syntaxHighlight lang="bash"> | <syntaxHighlight lang="bash"> | ||
$ git fetch | $ git fetch | ||
| Line 70: | Line 65: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
| - | Don't forget to remove your feature branch after successful merge. It's not needed anymore. | + | Don't forget to remove your feature branch after a successful merge. It's not needed anymore. |
<syntaxHighlight lang="bash"> | <syntaxHighlight lang="bash"> | ||
$ git branch -d myfeature | $ git branch -d myfeature | ||
| Line 85: | Line 80: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
| - | === 6. Create a | + | === 6. Create a release branch/tag === |
| - | When doing a minor (alpha or beta) release create a tag at appropriate revision that bumps up the version number. In case of a major (final) release create a branch (e.g. <code>firebug1. | + | 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. <code>firebug1.11</code>). |
Create minor version tag: | Create minor version tag: | ||
<syntaxHighlight lang="bash"> | <syntaxHighlight lang="bash"> | ||
$ ./bump-version.sh 1.10.0a5 | $ ./bump-version.sh 1.10.0a5 | ||
| - | $ git commit -a -m "[firebug-1. | + | $ git commit -a -m "[firebug-1.11.0a5]" |
| - | $ git tag 1. | + | $ git tag 1.11.0a5 |
$ git push --tags | $ git push --tags | ||
</syntaxHighlight> | </syntaxHighlight> | ||
| Line 98: | Line 93: | ||
Create major version branch: | Create major version branch: | ||
<syntaxHighlight lang="bash"> | <syntaxHighlight lang="bash"> | ||
| - | $ git checkout branch firebug-1. | + | $ git checkout branch firebug-1.11.0a5 |
</syntaxHighlight> | </syntaxHighlight> | ||
| Line 108: | Line 103: | ||
TODO: process for hot fixes in existing release branches | TODO: process for hot fixes in existing release branches | ||
| - | == Recommended | + | == Recommended settings == |
Recommended settings in your ''.gitconfig'' file: | Recommended settings in your ''.gitconfig'' file: | ||
| Line 125: | Line 120: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
| - | It's also useful to have following aliases defined in your ''.gitconfig'' | + | It's also useful to have the following aliases defined in your ''.gitconfig'' |
<syntaxHighlight lang="ini"> | <syntaxHighlight lang="ini"> | ||
Revision as of 21:05, 14 October 2012
Contents |
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
1. 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.
2. 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
3. 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
4. Open a pull request
If you need somebody from the team to review your code, open a pull request.
5. 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 :myfeature6. 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
TODO: process for hot fixes in existing release branches
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