aboutsummaryrefslogtreecommitdiff
path: root/content/posts/2023-05-23-i-was-wrong-about-git-workflows.md
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2023-06-27 14:50:20 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2023-06-27 14:50:20 +0200
commit8697555125c57ae64a0c9b78514b4aac4fd523de (patch)
treea699df53a7c35a4425f30bca86982c4341f6de40 /content/posts/2023-05-23-i-was-wrong-about-git-workflows.md
parent33b2615a5038bc85036081e8b5e0da8584d88097 (diff)
downloadmitjafelicijan.com-8697555125c57ae64a0c9b78514b4aac4fd523de.tar.gz
Massive formatting and added figcaption
Diffstat (limited to 'content/posts/2023-05-23-i-was-wrong-about-git-workflows.md')
-rw-r--r--content/posts/2023-05-23-i-was-wrong-about-git-workflows.md95
1 files changed, 47 insertions, 48 deletions
diff --git a/content/posts/2023-05-23-i-was-wrong-about-git-workflows.md b/content/posts/2023-05-23-i-was-wrong-about-git-workflows.md
index e1e45e8..16739de 100644
--- a/content/posts/2023-05-23-i-was-wrong-about-git-workflows.md
+++ b/content/posts/2023-05-23-i-was-wrong-about-git-workflows.md
@@ -7,66 +7,65 @@ type: posts
7tags: [] 7tags: []
8--- 8---
9 9
10I have been using some approximation of [Git Flow](https://jeffkreeftmeijer.com/git-flow/) 10I have been using some approximation of [Git
11for years now and never really questioned it to be honest. When I create a repo 11Flow](https://jeffkreeftmeijer.com/git-flow/) for years now and never really
12I create develop branch and set it as default one and then merge to master 12questioned it to be honest. When I create a repo I create develop branch and set
13from there. Seems reasonable enough. 13it as default one and then merge to master from there. Seems reasonable enough.
14 14
15One thing that I have learned is that long living branches are the devil. 15One thing that I have learned is that long living branches are the devil. They
16They always end up making a huge mess when they need to be merged eventually 16always end up making a huge mess when they need to be merged eventually into
17into master. So by that reason, what is the develop branch if not the longest 17master. So by that reason, what is the develop branch if not the longest living
18living feature branch. And from my personal experience there was never a 18feature branch. And from my personal experience there was never a situation
19situation where I wasn’t sweating bullets when I had to merge develop back 19where I wasn’t sweating bullets when I had to merge develop back to master.
20to master.
21 20
22This realisation started to give me pause. So why the hell am I doing this, 21This realisation started to give me pause. So why the hell am I doing this, and
23and is there a better way. Well the solution was always there. And it comes 22is there a better way. Well the solution was always there. And it comes in a
24in a form of [git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging). 23form of [git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging).
25 24
26So what are git tags? Git tags are references to specific points in a Git 25So what are git tags? Git tags are references to specific points in a Git
27repository's history. They are used to mark important milestones, such as 26repository's history. They are used to mark important milestones, such as
28releases or significant commits, making it easier to identify and access 27releases or significant commits, making it easier to identify and access
29specific versions of a project. 28specific versions of a project.
30 29
31Somehow we have all hijacked the meaning of the master branch that it has 30Somehow we have all hijacked the meaning of the master branch that it has to be
32to be the most releasable version of code. And this is also where the confusing 31the most releasable version of code. And this is also where the confusing about
33about versioning the software kicks in. Because master branch implicitly says 32versioning the software kicks in. Because master branch implicitly says that we
34that we are dealing with the rolling release type of a software. And by having 33are dealing with the rolling release type of a software. And by having a develop
35a develop branch we are hacking around this confusion. With a separation of 34branch we are hacking around this confusion. With a separation of develop and
36develop and master we lock functionalities into place and forcing a stable 35master we lock functionalities into place and forcing a stable vs development
37vs development version of the software. 36version of the software.
38 37
39But if that is true and the long living branches are the devil then why have 38But if that is true and the long living branches are the devil then why have
40develop at all. I think that most of this comes to how continuous integration 39develop at all. I think that most of this comes to how continuous integration is
41is being done. There usually is no granular access to tags and CD software 40being done. There usually is no granular access to tags and CD software deploys
42deploys what is present on a specific branch, may that be master for production 41what is present on a specific branch, may that be master for production and
43and develop for staging. This is a gross simplification and by having this 42develop for staging. This is a gross simplification and by having this in place
44in place we have completely removed tagging as a viable option to create a 43we have completely removed tagging as a viable option to create a fix point in
45fix point in software cycle that says, this is the production ready code. 44software cycle that says, this is the production ready code.
46 45
47One cool thing about tags are that you can checkout a specific tag. So they 46One cool thing about tags are that you can checkout a specific tag. So they
48behave very similarly as branches in that regard. And you don’t have the 47behave very similarly as branches in that regard. And you don’t have the
49overhead of having two mainstream branches. 48overhead of having two mainstream branches.
50 49
51So what is the solution? One approach is to use development workflow, where 50So what is the solution? One approach is to use development workflow, where all
52all changes are made on the smaller branches and continuously merged into 51changes are made on the smaller branches and continuously merged into
53master. Where the software is ready to be pushed to production you tag the 52master. Where the software is ready to be pushed to production you tag the
54master branch. This approach eliminates the need for long-lived branches and 53master branch. This approach eliminates the need for long-lived branches and
55simplifies the development process. It also encourages developers to make 54simplifies the development process. It also encourages developers to make small,
56small, incremental changes that can be tested and deployed quickly. However, 55incremental changes that can be tested and deployed quickly. However, this
57this approach may not be suitable for all projects or teams that heavily rely 56approach may not be suitable for all projects or teams that heavily rely on
58on automated deployment based on branch names only. 57automated deployment based on branch names only.
59 58
60This also requires that developers always keep production in mind. No more 59This also requires that developers always keep production in mind. No more
61living on an island of the develop branch. All your actions and code need to 60living on an island of the develop branch. All your actions and code need to be
62be ready to meet production standards on a much smaller timescale. 61ready to meet production standards on a much smaller timescale.
63 62
64I think that we have complicated the workflow in an honest attempt to make 63I think that we have complicated the workflow in an honest attempt to make
65things more streamlined but in the process of doing this, we have inadvertently 64things more streamlined but in the process of doing this, we have inadvertently
66made our lives much more complicated. 65made our lives much more complicated.
67 66
68In conclusion, it's important to re-evaluate our workflows from time to time 67In conclusion, it's important to re-evaluate our workflows from time to time to
69to see if they still make sense and if there are better alternatives available. 68see if they still make sense and if there are better alternatives available.
70Long-living branches can be problematic, and using tags to mark important 69Long-living branches can be problematic, and using tags to mark important
71milestones can simplify the development process. 70milestones can simplify the development process.
72 71