gitflow是一个确保nvie推荐的git branch分支策略最佳模型得到有效实施的辅助工具。它作为git的一个子命令而存在。 http://nvie.com/posts/a-successful-git-branching-model/
linux下安装非常简单 https://github.com/nvie/gitflow/wiki/Linux
$ yum install gitflow
安装完成以后git flow xxx就可以使用了。
git flow init [-d]
list,start,finish一个feature:
git flow feature
git flow feature start <name> [<base>]
git flow feature finish <name>
注意,For feature branches, the <base>
arg must be a commit on develop
.
push/pull一个feature branch到remote
git flow feature publish <name>
git flow feature pull <remote> <name>
list,start,finish一个release branch:
git flow release
git flow release start <release> [<base>]
git flow release finish <release>
对于release branch来说,base一定是一个develop上的commit
list,start,finish一个hotfix:
git flow hotfix
git flow hotfix start <release> [<base>]
git flow hotfix finish <release>
对于hotfix branch来说,base需要是一个master上的commit
list,start support branch:
git flow support
git flow support start <release> <base>
git flow中feature start/feature finish对应的底层操作log:
$ git fs myawesomefeature
git config --local gitflow.branch.feature/myawesomefeature.base dev
Branches 'dev' and 'origin/dev' have diverged.
And local branch 'dev' is ahead of 'origin/dev'.
git checkout -b feature/myawesomefeature dev
Switched to a new branch 'feature/myawesomefeature' Summary of actions:
- A new branch 'feature/myawesomefeature' was created, based on 'dev'
- You are now on branch 'feature/myawesomefeature' Now, start committing on your feature. When done, use: git flow feature finish myawesomefeature $ git ff
git fetch -q origin feature/myawesomefeature:refs/remotes/origin/feature/myawesomefeature
git checkout dev
Switched to branch 'dev'
Your branch is up-to-date with 'origin/dev'.
git merge --no-ff feature/myawesomefeature
GNU nano 2.2. File: /home/vagrant/Code/newkidsit/.git/MERGE_MSG Modified Merge branch 'feature/myawesomefeature' into dev # Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit. Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? Merge made by the 'recursive' strategy.
app/Models/Skill/Skill.php | ++
database/migrations/2016_10_16_191716_create_file_skill_pivot_table.php | +++++++++
public/prebuild/assets/css/style.css | +
resources/assets/js/vueapp/src/components/pages/adminfiles/assets-manager.vue | +++++++++++++++++++++++++++-------------
.../assets/js/vueapp/src/components/pages/adminfiles/file-upload-job-wrapper.vue | +++++++++++++++++++++++++++++++++++++
git push origin :feature/myawesomefeature
To git@github.com:myaccount/myrepo.git
- [deleted] feature/myawesomefeature
git branch -d feature/myawesomefeature
Deleted branch feature/myawesomefeature (was bf56c2d). Summary of actions:
- The feature branch 'feature/myawesomefeature' was merged into 'dev'
- Feature branch 'feature/myawesomefeature' has been locally deleted; it has been remotely deleted from 'origin'
- You are now on branch 'dev' $