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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:53:40+00:00 2026-05-16T22:53:40+00:00

I tried to get a former copy of my code by using the git

  • 0

I tried to get a former copy of my code by using the git checkout command. Before using this though, I committed the latest version of the code using git commit.

After using git checkout to a previous version, I made changes to the code. Git now informs me that because I’ve made changes I can no longer revert to that most recent version that I had committed.

I don’t care about the changes I made to this code I checked out, I just want to get back to the most recent version of the code. How do I do this?

Using the command git log no longer shows that most recent version before the checkout to a previous version.

  • 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-16T22:53:40+00:00Added an answer on May 16, 2026 at 10:53 pm

    You are most certainly in a detached head mode.
    That happens when you checkout a commit that is not at the tip of one of your branches (like a tag, git checkout V1.0).

    dd http://marklodato.github.com/visual-git-guide/checkout-b-detached.svg

    You can discard your temporary commits and merges by switching back to an existing branch (e.g. git checkout master).
    You can also use git reset: see What’s the difference between ‘git reset’ and ‘git checkout’?, and also “HEAD and ORIG_HEAD in Git“

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

Sidebar

Related Questions

I'm coding some c# against Active Directory and have tried endlessly to get this
I tried the following code to get an alert upon closing a browser window:
I tried using "cap rollback" but I get the following error: $ cap rollback
Have you managed to get Aptana Studio debugging to work? I tried following this,
Nothing I've tried can get my code to submit correctly. Can anyone else figure
has anyone ever tried to get the list of all the movieclips (even the
I tried running 'diff' against two source directories get a patch file with a
I get the following error when attempting to install RubyGems . I've tried Googling
I tried to install beautifulsoup. I get such an error: <-- snip --> raise
I just don't get it. Tried on VC++ 2008 and G++ 4.3.2 #include <map>

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.