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