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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:59:53+00:00 2026-05-31T02:59:53+00:00

I just did something dumb. In my fooclient project, I just did: git remote

  • 0

I just did something dumb. In my fooclient project, I just did:

git remote add official https://github.com/fooserver
git pull official master

In other words, I pulled a completely different codebase (the server, instead of the client) into my working directory. Not surprisingly, there weren’t many merge conflicts (the file names are all completely different, after all). Also not surprisingly, Git completely failed to warn me that the repos didn’t have a single common ancestor.

In this particular situation, I’m able to recover by doing this:

cp file-i-worked-on.js ~
git reset --hard HEAD # to discard broken merge conflicts
git checkout a12345 # where a12345 is the latest head of fooclient that I had checked out
cp ~/file-i-worked-on.js .

But what would be the more general strategy?

  • 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-31T02:59:54+00:00Added an answer on May 31, 2026 at 2:59 am

    This will reset you to the last state master was in:

    git reset --hard HEAD@{1}
    

    This is possible because of the reflog. Running git reflog will show you the reflog, and allow you to verify you’re resetting to the correct state.

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

Sidebar

Related Questions

I just did something dumb with my SVN repository, I accidentally imported a load
I see something strange like: http://github.com/zoul/Finch.git Now I'm not that CVS, SVN, etc. dude.
I'm using git and Codebase for a project. I just did a test and
Ok so I just did something boneheaded. I'm setting up a subversion server for
I just did File -> New Project last night on a new project. Ah,
I did just something really fucXXing stupid. I wrote over my actionscript code, saved
Please don't laugh at me but I believe that I just did something extremely
i just did a plain old mysql dump with something like this mysqldump -h
We just did a move from storing all files locally to storing them on
I just did a delete from table How do I roll back or undelete

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.