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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:07:54+00:00 2026-06-03T05:07:54+00:00

I just broke my codebase. I want to rollback to my last commit, but

  • 0

I just broke my codebase. I want to rollback to my last commit, but I want to save off the broken version first, so I can analyze it later. What’s the best course in this situation?

(I haven’t actually tried anything, just looking for some hand-holding- It’s been a long day and I don’t feel like screwing this up..)

  • 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-03T05:07:56+00:00Added an answer on June 3, 2026 at 5:07 am

    There are a few things you can do:

    Most likely the best thing for you to do is to create a separate branch to commit this broken code on, and commit to that branch.

    git checkout -b my-broken-branch # creates a new branch called my-broken-branch
    # commit as usual...
    git checkout - # return to the last branch you were on
    

    When you want to go back to that code, do a git checkout my-broken-branch to change over to that branch.


    A quick thing you can do is git stash, which will save your work and you can reapply it later:

    git stash
    

    When you want to get those changes back, you can do a git stash apply which will apply the last changes you stashed away (but keep the information in the stash list).

    As Andrew mentioned in the comments, you can also do git stash pop, which will apply the least stashed changes, and remove it from the stash list.

    There is more you can do with stashing, since you can do multiple stashes and selectively apply them back.

    Here’s a more detailed explanation when you want to get more in-depth on stashing: http://gitready.com/beginner/2009/01/10/stashing-your-changes.html

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

Sidebar

Related Questions

This was working just fine, not sure what broke it, but now I'm getting
How do I fix a broken debugger, one that just won't start, in EclipseME
Just trying out this IDE but it already looks better than NetBeans in terms
.NET 4 broke ValidateRequest=false for some reason. The solution is -- just put <httpRuntime
I was able to get jQuery autocomplete working in CoffeeScript just fine, but when
Does anyone have a sample post build event for Babel Obfuscator I can just
A small program of mine just broke because, it seems, the site I was
We have a perfectly functional app that just broke on Windows 7 because (the
Something broke and I get Object Expected error on my live site, but I
I just discovered that the iframe version of the Facebook Like button doesn't honor

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.