3 No Git Branch Problems



Test Image
Image credit: Pexels



In this chapter, we’ll examine a situation where two or more users work in the main branch without any divergence conflicts between updates. I’ll present a simple workflow where users make their own changes and updates without the situation escalating into branch problems.

This is a typical situation when everyone remembers to execute a pull command before making their own modifications, keeping the main branch stable.

3.1 Stable Main Branch


Situation: Remote Main (C0)


Work begins with the main branch in the remote repository, where the latest state is commit C0.
The remote repository is illustrated in the following diagram:





User 1: Pull (C0)


Pull: User 1 downloads the latest data from the remote repository (C0) to their local repository.





User 1: modification and push (C1)


  1. Modification: User 1 modifies files and makes commit C1.
  2. Push: Changes are updated back to the remote repository.

The situation in the remote repository after commit C1:





User 2: Pull (C1)


Pull: User 2 downloads commit C1 to their local repository.






User 2: modification and push (C2)


  1. Modification: User 2 modifies files and makes commit C2.
  2. Push: Changes are updated back to the remote repository.

The situation in the remote repository after commit C2:






3.2 Summary

In this simple example, both users worked in the main branch without conflicts. Each step follows logically from the previous one: pull → modification → commit → push.

In the next chapter, we’ll examine a situation where both users modify commit C0 simultaneously. This can lead to divergent branches and conflict resolution.




Divergent Git branches - from problem to solution © 2025 by Ville Langén is licensed under the CC BY-SA 4.0.

CC BY-SA 4.0