Overview
This workflow for git was developed by Vincent Driessen at nvie.
Branches:
master branch
- contains releases, often with a tag for each commitdevelopment branch
- features are merged into this branch before release-
feature branches
-
Setup develop branch
git branch develop
git push -u origin develop
-
Other developers should clone the repo and do
git checkout -b develop origin/develop
-
Now create a feature
git checkout -b some-feature develop
-
Add some stuff to this feature
echo "This is a nice feature" > some-feature
git add some-feature
git commit
-
Now checkout the develop branch and see that it doesn't contain the new feature
git checkout develop
ls
-
Let's merge the feature branch with develop
git merge some-feature
ls
-
Then delete the feature branch (which now is part of develop)
git branch -d some-feature
-
The process for merging develop with master is exactly the same. The develop branch is not deleted though.
Whenever something is merged into master should a tag be created:
git tag -a 0.1 -m "Initial public release" master
git push --tags
- Delete a remote branch:
git push origin --delete <branchName>
or like this:git push origin :<branchName>
Resources