The master/develop branches:
- Master Branch:
- Should be any time production deployable
- Only two scenario to update master:
- hotfix.
- production release.
- all tags go with master branch
- No need to have any routine Jenkins task to run any unittest against on this branch.
- Branch Release
- Used as stable branch to merge all features/bugs.
The feature branches:
- use develop as their parent branch.
- used to fix bug and add new feature
- used as internal branch and the life cycle won’t be more 2 weeks as the good practice.
- start a new feature branch
1
2
3
4
5
6
7
8
9
10
11
12
git checkout develop
# if go with jira, the ticket number will be FWS-1, etc.
git checkout -b feature/{ticket number}
# use --amend to keep commit transaction clear if possbile.
# since sometimes we can't make perfect commit and always forget sth.
# do your work
git add something
git commit -m "first commit"
git add another
git commit -m "second commit" --amend
# you can do rebase as much as you want in daily development.
# At least do rebase every morning to keep your local branch refresh.
5. when push the code, a new feature/{ticket number} will be created on origin
6. finish the feature branch
1
2
3
4
5
6
7
8
9
1. permanently rebase with origin/develop before create pull request
to avoid the pull request code merge conflict
git fetch
git rebase origin/develop
2. push your local featureXXX branch to origin/featureXXX.
3. create a pull request from origin/feature/{ticket number} to origin/develop
3.1 TODO: use teamcity to pre-pull-request check.
4. once review, use to merge the all commite into one on origin/develop
5. close branch feature/{ticket number}.
The release branch:
- At the code frozen phase, we create release branch
1
2
git checkout develop
git checkout -b release/0.1.0
2. Do all the release preparation work and urgent production fix.
3. create pull request to master. (rebase firstly)
4. DO NOT SQUASH MERGE when go for master. keep the feature commit history
5. create pull request to develop (may need rebase at first).
6. DO NOT SQUASH MERGE when go for develop as well. keep the behavior consistent between master and develop.
Common Sense
- master branch
- should be deployable branch, don’t touch the meste branch unless it must be required.
- set very restricted write access to master branch
- only the release manager can approve and do the update master branch.
- develop branch
- all code go to develop new code review through the pull request
- Any check in code to develop will trigger the unittest tasks from Jenkins (when Teamcity comes online, the task would launch upon a pull request).
- feature branch
- maintained by developers them self
- should be closed when the feature is done.
- try to break down the big feature to small feature and have single feature down. Jira introduced the parent issues and child issues that support such scenario.
- the workflow for new feature:
- master branch
- should be deployable branch, don’t touch the meste branch unless it must be required.
- set very restricted write access to master branch
- only release manager can approve and do the update master branch.
- develop branch
- all code go to develop new code review through the pull request
- Any check in code to develop will trigger the unittest tasks from Jenkins
- feature branch
- maintained by developers them self
- should be closed when the feature is done.
- try to break down the big feature to small feature and have single feature down. Jira introduced the parent issues and child issues that support such scenario.
- the workflow for new big feature:
- Create the Spike ticket to eval the scope and workflow and possible solution and technical challenge. most of case, it will take about 3 - 5 days. The scope for this ticket is as following:
- Pickup the technology we should use
- List all technical issues we need spent more time to do, if we can’t resolve them in the spike
- Create children tickets we can do without dependencies.
Comments
Post a Comment