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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:11:48+00:00 2026-06-05T00:11:48+00:00

I am new to git and github and I have some trouble. I am

  • 0

I am new to git and github and I have some trouble.

I am using github for windows to manage a small project I have. I think I’ve lost some changes I recently did to my code. What I did was:

  1. Changed some files.
  2. Accidentally committed the changes.
  3. Reverted the commit.
  4. Then I pressed “roll back to this commit”.

Now all changes are gone, including some new files I added. Can I save them? I have also installed git (command line) so I can execute any command you think will help.

  • 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-05T00:11:49+00:00Added an answer on June 5, 2026 at 12:11 am

    One of the nice things about git is that it’s REALLY hard to lose anything, unless you’re doing something weird.

    What you need to do is to find the point which represents the state at which you want to be.

    Let’s say you examine git log and determine that hash 01dbc4… is the point in time to which you want to return. To do so, simply do:

    git reset --hard 01dbc4
    

    Note that if you have uncommitted changes, you’ll need to stash them first.

    Now, if that commit is missing the extra files you want and they’re in a later commit, it gets a bit more complicated. But what you can do is set your master branch to the point from which you want to start, and then set a branch to the point which has the new files. You can then copy or or selectively merge the missing information from the new branch to your master branch, making your master branch look how you want it.

    Note that even if you move a branch’s pointer around like when using git reset –hard above and orphaned later commits, you get them back by examining git reflog and reseting to them, or creating a branch that points to them.

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

Sidebar

Related Questions

I am reasonably new to Git and recently forked a project from GitHub, made
I have my project on GitHub at some location, git@github.com:myname/oldrep.git . Now I want
I'm new to git. I use Windows, and github & bitbucket. I set up
GitHub Users, I am newbie on github and have some issue with git setup.
I added some Haml templates to my Rails 3 project with git clone git://github.com/psynix/rails3_haml_scaffold_generator.git
I have added a new GIT repo (private github repo) to Eclipse EGit repo
I have just started a new git repository. I followed the directions on github,
I'm using the git-new-workdir script present in contrib section of git's codebase: https://github.com/git/git/tree/master/contrib/workdir to
New to Git and still a little perplexed. I have forked a project on
I am new to git and github. Suppose I have a public github repository,

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.