This workflow uses two branches to record the history of the project.
Master - Stores the official release history
Develop - Serves as an integration branch for features.
Each developer should clone central repo with the develop branch to there local machine.
git clone /path/to/repository
git checkout -b develop origin/develop
Everybody now has a local copy of the historical branches set up.
Uses develop as its parent branch. When feature is complete it gets merged into develop. Features should never interact directly with master.
First create a branch for a features. (make name descriptive)
git checkout -b some-feature develop
Add commits to the feature branch in the usual fashion: edit, stage, commit.
git status
git add .
git commit
Merge into local develop branch and push into central repo.
git pull origin develop
git checkout develop
git merge some-feature
git push
git branch -d some-feature
Fork a release branch off of develop. -Check for bugs and other release-oriented tasks. -Once it's ready merged into master.
Create new branch from develop branch.
git checkout -b release-0.1 develop
When the release branch is ready to be merge.
git checkout master
git merge release-0.1
git push
git checkout develop
git merge release-0.1
git push
git branch -d release-0.1
Tag the commit for easy reference.
git tag -a 0.1 -m "Initial public release" master
git push --tag
Maintenance or “hotfix” branches are used to quickly patch production releases.
When an end-user discovers a bug fork from master.
git checkout -b issue-#001 master
# Fix the bug
git checkout master
git merge issue-#001
git push
After fixing bug merge the branch back to master.
git checkout develop
git merge issue-#001
git push
git branch -d issue-#001