From 57171384410dcd2bacff38cf92b6e9717462d4ce Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 26 Nov 2022 17:40:18 +0000 Subject: [PATCH] docs(daily-email): add 2022-11-23 --- website/src/daily-emails/2022-11-23.md | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 website/src/daily-emails/2022-11-23.md diff --git a/website/src/daily-emails/2022-11-23.md b/website/src/daily-emails/2022-11-23.md new file mode 100644 index 00000000..1a5ab735 --- /dev/null +++ b/website/src/daily-emails/2022-11-23.md @@ -0,0 +1,33 @@ +--- +title: > + Do you need to branch if you're the only one working on a project? +pubDate: 2022-11-23 +permalink: > + archive/2022/11/23/do-you-need-to-branch +tags: + - git +--- + +Yesterday, I [saw a tweet](https://twitter.com/scottkeckwarren/status/1594752744165847040) where the writer said they were “falling into the branch, pull request, and merge after actions pass I use at work even though I'm the only one working on it”. + +After reading this, my question is, "Should you, or do you need to, create branches if you're the only person working on a project?". + +These days, I use trunk-based development as much as possible, so I hardly ever create new branches, whether working on a project myself or with a team. + +[I used to use Git Flow](https://www.oliverdavies.uk/talks/git-flow) and create branches for every new feature and bug fix, but I remember, whilst demonstrating two work-in-progress features to a client, switching between the different branches caused my local site to break. Whilst it wasn’t a major issue, it wouldn't have seemed professional. + +In a team environment, feature branches are intended to keep different changes and different people's work separate. + +But is this needed if you’re the only in the team? + +Assumingly, you're only working on one change at a time, so what's the benefit of creating a separate branch? + +If you need to switch to a different task, another approach could be to revert your work-in-progress commits, move them onto another local branch temporarily, or wrap them within a feature flag so that the changes are committed but not active. + +The other part of the tweet said, “I like the little integrations to make sure the tests pass”. + +I’m comfortable working on a single branch and committing and pushing small changes often. + +My CI pipelines run for every change that I push, and if one fails, I’ll either push a small fix to get it passing again or revert the failing change and investigate further. + +For me, working on a single branch keeps my workflow simple and lean, allowing me to focus on the changes and the tasks that I need to work on and not worry about which branch I’m working on.