Over a million developers have joined DZone.

Understand How Divergent Branches Appear After Fetching a Remote Repository

DZone's Guide to

Understand How Divergent Branches Appear After Fetching a Remote Repository

· Web Dev Zone ·
Free Resource

Learn how error monitoring with Sentry closes the gap between the product team and your customers. With Sentry, you can focus on what you do best: building and scaling software that makes your users’ lives better.

A picture is worth a thousand words! The Animated Git series continues. The series introduces core Git concepts with pictures and animations. If you missed it, watch and read :

This fourth part presents how divergent branches can appear in your repository. You’ll better understand why they are called “branches”.

Work in parallel

As you learned in Part 2, you commit locally. As a result, two team members can create commits on top of origin/master in parallel (read Part 3 to learn more about this branch):

Bob is free to push his work to the team’s repository:

Fetch from the remote repository

Alice is now out of sync with the team’s repository and, as a result, is unable to push her work. She must re-synchronize her local repository by fetching the shared repository (called “origin”, as explained in Part 3) :

$ git fetch origin 

As you can see, Alice’s master and origin/master branches have diverged, like two branches of a tree:

We recommend the following articles to learn more about branches and fetching a remote repository:

A new animated series will start soon. Follow us on @WakandaSoft to catch it!

What’s the best way to boost the efficiency of your product team and ship with confidence? Check out this ebook to learn how Sentry's real-time error monitoring helps developers stay in their workflow to fix bugs before the user even knows there’s a problem.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}