linux下gitflow輔助工具安裝和使用

世有因果知因求果發表於2015-06-03

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.6                    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                                                           |   5 ++
 database/migrations/2016_10_16_191716_create_file_skill_pivot_table.php              |  39 +++++++++
 public/prebuild/assets/css/style.css                                                 |   3 +
 resources/assets/js/vueapp/src/components/pages/adminfiles/assets-manager.vue        | 179 +++++++++++++++++++++++++++-------------
 .../assets/js/vueapp/src/components/pages/adminfiles/file-upload-job-wrapper.vue     | 169 +++++++++++++++++++++++++++++++++++++
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'

$ 

 

相關文章