<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Toby Jones</title>
    <description>The latest articles on DEV Community by Toby Jones (@tobyjonesdaily).</description>
    <link>https://dev.to/tobyjonesdaily</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4244611%2F17ae3bce-7837-4b96-9142-fd37c32ba8c1.png</url>
      <title>DEV Community: Toby Jones</title>
      <link>https://dev.to/tobyjonesdaily</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tobyjonesdaily"/>
    <language>en</language>
    <item>
      <title>Understanding Git Branching and Merging: How Multiple Developers Collaborate on One Project</title>
      <dc:creator>Toby Jones</dc:creator>
      <pubDate>Sat, 14 Nov 2026 14:36:08 +0000</pubDate>
      <link>https://dev.to/tobyjonesdaily/understanding-git-branching-and-merging-how-multiple-developers-collaborate-on-one-project-2i51</link>
      <guid>https://dev.to/tobyjonesdaily/understanding-git-branching-and-merging-how-multiple-developers-collaborate-on-one-project-2i51</guid>
      <description>&lt;p&gt;As part of my journey into DevOps engineering, I've been working on understanding how developers collaborate using Git and GitHub.&lt;/p&gt;

&lt;p&gt;One important concept I've been practicing is &lt;strong&gt;Git branching and merging&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In a real development environment, multiple developers can work on the same application simultaneously. Rather than everyone modifying the main branch directly, developers work on separate branches and eventually integrate their changes.&lt;/p&gt;

&lt;p&gt;Here's what I learned.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Why do we use Git branches?
&lt;/h2&gt;

&lt;p&gt;Imagine a team with three developers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Developer A is working on new features.&lt;/li&gt;
&lt;li&gt;Developer B is fixing bugs.&lt;/li&gt;
&lt;li&gt;Developer C is implementing updates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of everyone working directly on the main branch, each developer can work independently.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch development
git branch patches
git branch updates
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Switch between branches using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout development
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This allows developers to work on different parts of a project without immediately affecting the main codebase.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Understanding merge conflicts
&lt;/h2&gt;

&lt;p&gt;One interesting part of the exercise was understanding how merge conflicts happen.&lt;/p&gt;

&lt;p&gt;Imagine two developers modifying the same file, &lt;code&gt;index.html&lt;/code&gt;, on different branches.&lt;/p&gt;

&lt;p&gt;Developer A adds:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Welcome to my application&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Developer B adds:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Welcome to our application&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When both branches are merged, Git may encounter conflicting changes.&lt;/p&gt;

&lt;p&gt;Git cannot automatically determine which version the team intends to keep.&lt;/p&gt;

&lt;p&gt;This is where merge conflict resolution becomes important.&lt;/p&gt;

&lt;p&gt;The engineer must inspect the conflicting sections, decide how the changes should be combined, and commit the resolution.&lt;/p&gt;

&lt;p&gt;An important distinction: using different filenames can prevent certain filename-related conflicts, but it doesn't eliminate merge conflicts generally.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Practising Git merging
&lt;/h2&gt;

&lt;p&gt;During the practical session, I worked with multiple branches:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;development&lt;/li&gt;
&lt;li&gt;updates&lt;/li&gt;
&lt;li&gt;patches&lt;/li&gt;
&lt;li&gt;security&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The objective was to make changes on separate branches and eventually bring the work together into the main branch.&lt;/p&gt;

&lt;p&gt;The basic workflow looked like this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Switch to the main branch&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Pull the latest changes&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git pull origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3: Merge the development branch&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git merge development
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4: Merge the remaining branches&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git merge updates
git merge patches
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Merging branches individually makes it easier to identify which integration introduces a conflict.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. What happens when a merge conflict occurs?
&lt;/h2&gt;

&lt;p&gt;When Git encounters conflicting changes, it marks the affected sections of the file.&lt;/p&gt;

&lt;p&gt;You need to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Identify the conflicting file.&lt;/li&gt;
&lt;li&gt;Inspect the conflicting sections.&lt;/li&gt;
&lt;li&gt;Decide which changes to retain or combine.&lt;/li&gt;
&lt;li&gt;Remove the conflict markers.&lt;/li&gt;
&lt;li&gt;Stage the resolved file.&lt;/li&gt;
&lt;li&gt;Commit the resolution.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add index.html
git commit -m &lt;span class="s2"&gt;"Resolve merge conflict in index.html"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. What I'm taking away from this exercise
&lt;/h2&gt;

&lt;p&gt;A major takeaway is that Git is more than a tool for storing code.&lt;/p&gt;

&lt;p&gt;It provides a structured way for engineering teams to collaborate, manage changes and integrate contributions.&lt;/p&gt;

&lt;p&gt;As someone transitioning into DevOps engineering, understanding these workflows is important because they form part of the foundation of CI/CD.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's next on my learning list?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I want to take this further by exploring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pull Requests (PRs)&lt;/li&gt;
&lt;li&gt;GitHub Actions&lt;/li&gt;
&lt;li&gt;Automated testing before merging&lt;/li&gt;
&lt;li&gt;Branch protection rules&lt;/li&gt;
&lt;li&gt;CI/CD pipeline triggers&lt;/li&gt;
&lt;li&gt;Automated deployment after successful merges&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is to understand how code moves from a developer's local environment to a production environment.&lt;/p&gt;

&lt;p&gt;One practical session at a time.&lt;/p&gt;

&lt;h1&gt;
  
  
  DevOps #Git #GitHub #CICD #CloudEngineering #LearningInPublic
&lt;/h1&gt;

</description>
      <category>devops</category>
      <category>git</category>
      <category>github</category>
      <category>softwareengineering</category>
    </item>
  </channel>
</rss>
