11= Gitworkflow
2+ :homepage: https://github.com/rocketraman/gitworkflows
23
34The https://git.kernel.org/pub/scm/git/git.git/[git.git] project, responsible for the creation and maintenance of the
4- https://git-scm.com/[git] tool itself, uses an amazing workflow I call "gitworkflow", in deference to its creators
5+ https://git-scm.com/[git] tool itself, uses a powerful workflow I call "gitworkflow", in deference to its creators
56and the https://git-scm.com/docs/gitworkflows[man page] in which it is described.
67
78I describe the advantages of this workflow, in comparison to the popular
@@ -10,3 +11,100 @@ http://endoflineblog.com/oneflow-a-git-branching-model-and-workflow[OneFlow] in
1011https://hackernoon.com/how-the-creators-of-git-do-branches-e6fcc57270fb[How the Creators of Git do Branching].
1112
1213This repository is meant to be a place in which tools and documentation related to gitworkflow can be created.
14+ 15+ == TL;DR
16+ 17+ * See the link:./docs/concepts-summary.adoc[Concepts Summary]
18+ * See the link:./docs/task-oriented-primer.adoc[Task-Oriented Primer]
19+ 20+ == Key Advantages
21+ 22+ The key advantages gitworkflow over GitFlow and OneFlow all come from treating topics as first-class citizens, not just
23+ temporary placeholders for unfinished code.
24+ 25+ === Amazing History
26+ 27+ Gitworkflow presents a history that code historians, and conscientious developers can love. It can easily present both
28+ summary (e.g. "show me all the topics merged into a release") and highly detailed views (e.g. "show me all the commits
29+ related to a topic").
30+ 31+ === Continuous Integration, Done Right
32+ 33+ Ever struggled with the decision about when to merge a topic branch to the main branch (`develop` in GitFlow / `master`
34+ everywhere else)?
35+ 36+ With GitFlow and OneFlow, in order to get the benefit of
37+ https://martinfowler.com/articles/continuousIntegration.html[Continuous Integration], you have to either test each topic
38+ branch in isolation, OR you have to merge it to the main line. Testing the topic in isolation, well, tests in isolation,
39+ which is "continuous", but isn't "integration". Waiting to merge until the topic is "done" means you can only test it
40+ along with other work that is also "done". This is "integration", but it isn't "continuous". So neither approach gets
41+ us continuous integration.
42+ 43+ This tension exists between "continuous" and "integration" because in most non-trivial projects, topics don't have a
44+ binary done/not done state: they are almost always a work in progress, with their stability being an analog continuum,
45+ not a digital value. We really want to do "continuous integration" of topics, even before they are considered "done"
46+ (i.e. released).
47+ 48+ With gitworkflow, the stability level of a topic is explicit -- and we can do true "continuous integration" of all the
49+ unreleased alpha-quality topics merged together to create an "alpha" release, all the unreleased beta-quality topics
50+ merged to create a "beta" release, and lastly all of the released topics.
51+ 52+ The early "continuous integration" of topics before they are "done" allows identification of conflicting work on
53+ different topics early in their development, prompting the right conversations and coordination between devs at the
54+ right time.
55+ 56+ ==== Make Your Topics Great
57+ 58+ Gitworkflow allows the alpha and beta-quality integration branches to be rewound and rebuild. This property allows
59+ topics to be massaged via interactive rebase until they form a series of easily understandable and reviewable chunks of
60+ work. With other flows, this is only an option until the topic is considered "done" and is merged to the main line for
61+ CI and user testing. Gitworkflow removes the limitation that a topic branch cannot be interactively rebased after it has
62+ been merged for CI and user testing, and generally for alpha-quality topics, this would be expected rather than frowned
63+ on.
64+ 65+ === Flexibility
66+ 67+ Sometimes features take longer to develop than expected. Sometimes they don't work well with other work in progress and
68+ need to be thrown away and a new approach taken. Sometimes everyone thinks they are "done", but they don't test well or
69+ they cause regressions.
70+ 71+ In most flows, this code is already on the main line of development. It has to be reverted (which can be easy or hard
72+ depending on the flow and the method used to merge the topic).
73+ 74+ In contrast, Gitworkflow defines a range of stability levels that the code "graduates" through, from raw unfinished code
75+ ("alpha") to code ready for testing ("beta") to code ready for release. Code can spend as much time as it needs to at
76+ each of these "levels", and when code is merged to the main line, it is production-ready. Thus gitworkflow supports
77+ continuous deployment scenarios as well.
78+ 79+ Gitworkflow allows you to define your own stability levels if you wish: add or remove integration branches as necessary.
80+ 81+ == Main Insights
82+ 83+ One key insight that makes gitworkflow work over flows like GitFlow and OneFlow is that: git is smarter than your
84+ average source control system. Topics don't have to be merged _only into the branch they were started from_, which seems
85+ to be the implicit or explicit assumption most flow authors make. In git, the topic can be merged _into any branch that
86+ it shares a common ancestor with_.
87+ 88+ This means that topic branches can be merged to multiple integration branches, each with a different purpose
89+ corresponding to the stability levels defined above.
90+ 91+ A second key insight is that, when topics are first-class citizens, early integration branches are just ephemeral
92+ placeholders for various combinations of topics, and can easily be recreated (rewind and rebuild). The integration
93+ branches are therefore unimportant and don't need to be a limiting factor for work on topics, such as rebasing, and
94+ we are free to experiment with moving topics in and out of them.
95+ 96+ == Disadvantages
97+ 98+ Gitworkfow is more complicated, and harder to understand than most (probably all) other flows. It requires more
99+ understanding of git concepts and capabilities. It offers significant powerful capabilities to complex multi-dimensional
100+ products with a team of developers, but does have more "overhead" in the sense of multiple things to track and
101+ understand. This means that:
102+ 103+ * Gitworkflow should not be used without significant team maturity using, or willingness to learn, git, and
104+ * Gitworkflow is serious overkill for trivial or one-man projects (but these might be a good place to try it out).
105+ 106+ == Interested in Learning More?
107+ 108+ * Read the https://hackernoon.com/how-the-creators-of-git-do-branches-e6fcc57270fb[blog post]
109+ * See the link:./docs/concepts-summary.adoc[Concepts Summary]
110+ * See the link:./docs/task-oriented-primer.adoc[Task-Oriented Primer]
0 commit comments