From b5f242bf057b85f26f236e2751af747d1acb8943 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 5 Mar 2025 20:45:37 +0000 Subject: [PATCH] Add daily email for 2025-02-18 Feature branches cause merge conflicts --- source/_daily_emails/2025-02-18.md | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 source/_daily_emails/2025-02-18.md diff --git a/source/_daily_emails/2025-02-18.md b/source/_daily_emails/2025-02-18.md new file mode 100644 index 00000000..abdd8c31 --- /dev/null +++ b/source/_daily_emails/2025-02-18.md @@ -0,0 +1,41 @@ +--- +title: Feature branches cause merge conflicts +date: 2025-02-18 +permalink: daily/2025/02/18/conflicts +tags: + - software-development + - git +cta: ~ +snippet: | + PSA: feature branches cause merge conflicts. +--- + +A common approach I see on software projects is where Developers create separate Git branches for each task they work on. + +This commonly matches issues or ticket on a sprint board or issue tracker. + +Each ticket is worked on independently and merged into a long-lived mainline branch once complete. + +This type of approach is commonly called Git Flow or GitHub Flow. + +It's something [I've given presentations][0] on in the past. + +A common downfall is that different branches can conflict with each other - either due to a merge conflict where the same lines are changed in different branches, or incompatible code is written that works separately but not when merged together. + +I used to work this way, even when working on projects as the only Developer. + +One time, I was demoing two features to a client and needed to switch branches and doing so broke what it was trying to show. + +These days, I avoid conflicts between branches by not branching. + +Everyone works on a single branch and pulls and pushes changes regularly. + +If you're [doing continuous integration][1], that should be once a day as an absolute minimum. + +I do [test-driven development][2] and usually commit after each passing test. + +If you work on a single branch and pull and push changes regularly, you're much less likely to get merge conflicts and Developers can focus on pushing code instead of fixing merge conflicts. + +[0]: {{site.url}}/presentations/git-flow +[1]: {{site.url}}/daily/2025/02/17/ci-cd +[2]: {{site.url}}/atdc