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

  • Home
  • SEARCH
  • 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 6855823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:48:23+00:00 2026-05-27T01:48:23+00:00

I did a checkout to an earlier commit: git checkout 12345 Then back to

  • 0

I did a checkout to an earlier commit:

git checkout 12345

Then back to the last commit:

git checkout 56789

And then continued committing and I’m:

Not currently on any branch.

Perhaps, I should’ve done:

git checkout master

After the first checkout, instead of pointing to a commit id.

Still, any idea how to get my latest commits into the master branch (which is a few commits behind)?

Thanks

  • 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-27T01:48:24+00:00Added an answer on May 27, 2026 at 1:48 am

    When you do git checkout 12345 you will be in no branch state. Do not do that. This is meant for commit inspection rather than working in it.

    If you are on master and want to reset your master to the commit that you wanted, use git reset 12345 ( or supply --hard ) If you wanted to branch, use git checkout -b <name> <sha1> to create a branch at that point and start working there.

    Similarly while coming back, like you mentioned, you should have done git checkout master

    Now that you have committed over 56789, note down the commit over 56789, and then checkout master, and do:

    git reset <commit_over_56789>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I did: git clone git://github.com/xyz/xyz.git git tag -l release-1.0.0 release-1.0.1 release-1.0.2 git checkout release-1.0.2
I did: git checkout sign-up And got this: M Gemfile Switched to branch 'sign-up'
I did a git commit -m message like this: > git commit -m save
I just checked out an earlier commit from my local git repo. I haven't
I did git checkout master . If I do git status it shows two
I did a checkout of d-gecko SDK from sf.net ( http://sourceforge.net/projects/d-gecko/ ). I wanted
Did you ever had a bug in your code, you could not resolve? I
I had a little disaster: I did an undo checkout in my .aspx.vb file
I did a git stash pop and ended up with merge conflicts. I removed
I did this (on my production server): $ git branch * master $ git

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.