4. git branch
git branch - list all branches locally
git branch -r - list all branches on the
remote side
git branch -d <XXX> - delete branch XXX
git branch -m <XXX> <YYY> - rename XXX to
YYY
5. git checkout
git checkout <BRANCH NAME> - switch to
that branch
git checkout -b <BRANCH NAME> - create a
new branch and switch to that branch
6. git reset
git reset --hard HEAD - give up all
uncommited changes
git reset --hard HEAD^ - back to the last
commit
ATTENTION: these changes are permanent,
you can not restore. Be careful.
9. before rebase
A -> B -> C -- branch
/
D -> E -> F -- master
10. after rebase
A -> B -> C -- branch
/
D -> E -> F -- master
11. how we work
master branch is the root branch, you should
not develop under this branch
all feature development should under their
own branches
only when a feature is finished can it be
merged into develop branch
bug fix should have its own branch
12. example
initiate a repository
create a new branch: develop
create a new feature branch:feature1
merge feature1 into develop
create a new feature branch:feature2
merge feature2 into develop
merge develop into master and create a tag for it
13. when you fix a bug
create a new branch from develop: 512
fix your bug
switch to develop
merge branch 512
delete branch 512 - this step is optional
14. work with svn
I don’t use any plugins for it
always update svn in master branch
always commit svn in master branch
develop or fix bug in new git branch
merge into master branch
rebase other branches if master get updates
15. git flow
it’s a very successful git branch model
it have 2 important branches: master, develop
develop is the hot branch, all tests can be
done under this branch
16. feature
release branches
branches develop hot xes master
Tag
Time
0.1
Major Severe bug
feature for xed for
Feature production:
next release
for future hot x 0.2
release
Incorporate
bug x in
develop
Tag
0.2
Start of
release
branch for
From this point on,
1.0
“next release”
means the release
after 1.0
Only
bug xes!
Bug xes from
Tag
rel. branch
may be 1.0
continuously
merged back
into develop