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 8476329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:08:54+00:00 2026-06-10T18:08:54+00:00

I have a repo that I’ve been using with GitHub. Previously, the repo had

  • 0

I have a repo that I’ve been using with GitHub. Previously, the repo had only 1 branch (i.e. master) and was fully up-to-date with the remote repo, but having done 2 local commits of new experimental work, I decided that what I wanted to do was create a new branch with those 2 commits on a “dev” branch which would still be accessible on GitHub as an alternative branch.

Therefore, I did the following:

git branch dev             # create new branch
git reset --hard HEAD~2    # roll back 2 commits on HEAD
git checkout dev           # make dev the active branch

Locally, all is now good. I now have my two local branches: master (which is 2 commits behind — on the stable version) and dev (HEAD) which is on the current experimental work.

However, on the GitHub side, all is not well: I have two branches, master (HEAD) and dev, however both of them are exactly the same (i.e. the two latest commits are on the master branch, when actually I only want them on the dev branch).

So just to summarise, if we call the latest unstable commit (dev work), commit 10, and the stable commit number 8, then we have the following:

10 – dev, origin/master, origin/dev, origin/HEAD

9

8 – master

So the question is how I get origin/master to correctly point to commit 8. (And also I’m confused by the role of origin/HEAD in all of this…)

  • 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-06-10T18:08:56+00:00Added an answer on June 10, 2026 at 6:08 pm

    If you want to change the history of master, you need to git push -f origin master in order to make GitHub record the new HEAD for master. (Make sure to warn any collaborator of that change: they need to reset their local master branch to that new HEAD).
    Pushing dev wasn’t enough.

    origin/HEAD reference the HEAD of the remote GitHub repo (which should be origin/master, unless you explicitly changed it through the GitHub repo Admin interface).

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

Sidebar

Related Questions

I have a repo on GitHub with a single branch master that I've been
We need to have a read only github repo that mirrors our main branch.
I have a project that's using git. When I received the repo, it had
I have a repo that I have a master branch which will end up
I have a branch in a badly structured svn repo that needs to be
I have a github repo that I want to push to a heroku node.
I have a fork to a github repo that I want to merge with
I have a Git repo that I have deleted four files from using rm
I have a Git repo that has been acting funny. I can checkout all
I have a bare repo that receives only pushes. When such pushes are made,

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.