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