Git Glow Simple Introduction to Git-flow, is a tool that is a specification
Git flow is a model of the Organization's software development activities built on GIT and is a software development best practice built on top of git. Git flow is a set of behavior specifications and a tool for simplifying some git operations when using Git for source control.
(http://www.ituring.com.cn/article/56870)
So, Git-flow is a rule, a convention, a specification, not a scourge, is an advanced practice to improve your use of git technology.
Git-flow Branch management mechanism based on Git itself
So, you must first understand what is a git branch (branch). Please look at the picture
Because of the temporal relationship, we assume that you already know what a branch is, Git-flow is to implement feature development, bug fixes, release releases, and conflict handling during development by dividing different branches into a single project.
(If you feel that this description is a bit around, don't understand it for the time being.) )
Git-flow divided the branches into several categories
Master
就是平时我们看到的master,项目的主要分支,对外的第一门面。所有外人浏览你的项目,使用你的项目,第一时间都是看到master。你可以把它理解成 稳定无bug发布版 。(任何时候都ready to deploy)所以,git-flow 要求我们不能在master下做开发。
Develop
处于功能开发最前线的版本,查看develop分支就能知道下一个发布版有哪些功能了。develop一开始是从master里分出来的,并且定期会合并到master里,每一次合并到master,表示我们完成了一个阶段的开发,产生一个稳定版。同样的,develop下也不建议直接开发代码,develop代表的是已经开发好的功能的回归版本(为什么说回归?)
Feature
带着develop处的疑问,我们在feature里为你解答。(有点长,别不看)feature的作用是为每一个新功能从develop里创建出来的一个分支。例如小明和小白分别做两个不相干的功能,就应该分别创建两个分支,各自开发完以后,先后合并到develop里,这就叫做回归。在这个过程里,小明小白不需要任何的沟通,分别并行地开发,git-flow能很好的处理好分支间并行开发的关系。而develop,则会在适当的时候,由合适的人,合并到master,作为下一个稳定版本。
Hotfix
以上3种以外,还有一个很重要的类型,hotfix。它是用来修复紧急bug的,而bug通常是来自线上的,所以hotfix分支是从master里创建出来的,并且,在bug修改好以后,要同时合并到master和develop,这一点需要特别注意。
Release
release更多倾向与版本发布,项目上线前的一些全面测试以及上线准备。同样也肩负着版本归档,回滚支持等。
Start using
As mentioned above, Git-flow essence is only a convention, so you can complete all Git-flow operations manually (manually create, merge branches, etc.) in the current git command line, focusing on compliance with the Git-flow specification, adherence to naming conventions, and branch management processes.
However, Git-flow already has a plugin. See this article:
http://blog.163.com/tod_zhang/blog/static/1025522142012913113957679/
With this plugin installed, your git has a number of handy commands, such as:
git flow init
Git flow feature start
Git flow feature finish
Wait a minute.
However, I think this plugin is not convenient, I recommend you all use Sourcetree wall crack.
If I want to recommend a Git-flow client, I will recommend Sourcetree.
If I want to recommend a git client, then I recommend Sourcetree.
Yes, Sourcetree is a git client specifically developed for Git-flow, which covers all of the features of Git itself,
So even if you don't flow, you can use Sourcetree to manage your git project.
Official website:
https://www.sourcetreeapp.com/
As for how to download, install,/* hack * *, these content will be handed to you Baidu.
Detailed description
So let's take a practical look at how Sourcetree helps us use Git-flow
1. Xiaoming creates a new project, does a Demo, and uses Sourcetree to open it. If this is not a step, you should not do the development.
(A new project, will not send a map)
2. In order to use Git-flow, Xiaoming needs to initialize the GIT project once.
These can be changed, in order to facilitate the other collaborators, or the default is good.
3. After the initialization, will automatically switch to the develop branch, next, Xiaoming to send a new function
Note the Git flow button, where all Flow functions are started. In the popup window to enter the name of the function, Xiao Ming decided to develop a test1 function.
At this point, the menu on the left has seen the branch switch to test1 (with bold effect)
4. Then Xiao Ming began the dark coding process, painstakingly wrote a line of Readme
Next we'll show you how to commit the changes
This interface is very clear to tell you that there is no commit code locally,
Of course, this is only a commit to the local, because this is always git, we also need to push to the far end.
You can see on the left, how many commits we have staged. Follow the diagram process, select the branch you want to push, you can also select more than one at a time, here we first push the function branch test1.
5. After several times of code, Xiaoming thinks the function has been developed and can be returned to develop.
Note that this time, only the Test1 code is changed, develop still stay in the state when Xiaoming created feature.
For security reasons, it's best to pull the develop before each merger, again without a table. (Sourcetree Pull)
So now we're merging the developed test1 into the develop:
The whole interface is very simple, just one operation, actually, it does a lot behind it. (@ -_-)
If there is no accident, the changes in the Test1 will be merged into the develop, and the local test1 will be deleted.
Then switch the branch to develop, when we should be able to see the number of changes throughout the Test1 period:
Next you should push the develop changes to the far end immediately!
OK, this is a complete process of functional development, even if multiple functions are developed in parallel,
Through the coordination of the Git-flow, all can be developed independently of each other, and ultimately all effect on the develop.
Git-flow take you to fly!