Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7505033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:46:29+00:00 2026-05-29T21:46:29+00:00

So I have 2 branches on GitHub: master and branchA. Say I’ve been working

  • 0

So I have 2 branches on GitHub: master and branchA. Say I’ve been working on master and master is ahead by 3 commits or something. So there are commits d, e, and f on master that are not in branchA. Say next that my colleague uploaded branchA to GitHub with commit g. So we have:

master: a, b, c, d, e, f
branchA: a, b, c, g

Say now I want to switch to branchA and pull exactly what is on GitHub. The issue I’m running into is when I use git branch branchA it will automatically use master as my starting position and thus add d,e,f and when I pull branchA I get conflicts as g and d,e,f are not yet compatible.

Is there a way to pull from GitHub such that my local commit log matches that on GitHub? I tried git pull -f but that obviously didn’t work either.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T21:46:31+00:00Added an answer on May 29, 2026 at 9:46 pm

    you should

    git fetch
    

    then inspect what has transpired with something like

    git log --all --oneline --graph --decorate
    

    Now you can merge or rebase the work that was done at the same time. Any branches prefixed with “origin” will be what’s on github (assuming that’s where you cloned from). Local branches will be coloured differently too.

    If you want to work a branch that was pulled down that you haven’t worked on yet, check it out and track it in a local branch with

    git checkout -t origin/someBranch
    

    I would only use pull in exceptional cases where I’m merging or rebasing my own work. Depending on what someone else did, I may choose rebasing over merging.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sometimes I'm working with several branches at once. Say I have branches called master,
In GitHub, I have two branches working and master branch. Now I wanted to
I have a git repository (at github.com) with two branches: master and gh-pages. I
So I have 3 git branches: master refresh auth_upgrade I haven't really been using
I have a public repository at github.com with 2 branches : master and test
I have a GitHub repository with two branches master and gh-pages . I am
I have two branches master and exp i tried to cherry pick some of
I have two branches with several commits each. On one branch, I can go
Given that two branches have diverged and a specific commit from one branch (and
I have a project hosted on github. There is a main branch (main-branch) for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.