DZone
Web Dev Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Web Dev Zone > Understand How Divergent Branches Appear After Fetching a Remote Repository

Understand How Divergent Branches Appear After Fetching a Remote Repository

Cedric Soulas user avatar by
Cedric Soulas
·
Mar. 21, 17 · Web Dev Zone · Interview
Like (2)
Save
Tweet
3.29K Views

Join the DZone community and get the full member experience.

Join For Free

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 :

  • Part 1 – Gain precise control over your next commit
  • Part 2 – Work offline on your own local repository
  • Part 3 – Remember the latest synced version and push your local changes

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:

  • https://www.atlassian.com/git/tutorials/syncing/git-fetch
  • https://www.atlassian.com/git/tutorials/using-branches/git-branch
  • https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches

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

Repository (version control) Branch (computer science) workplace

Published at DZone with permission of Cedric Soulas, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Pub/Sub Design Pattern in .NET Distributed Cache
  • What Is Edge Compute? It’s Kind of Like Knitting Dog Hats
  • Version Number Anti-Patterns
  • On Architects, Architecture, and Failures

Comments

Web Dev Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo