0

I am working on a large project. I am working entirely on the back-end; others are working on the front-end.

I have not updated the front-end for about a month or two, since all the base functionality I needed was baked in for development of the back-end (the front-end team is doing stuff like optimizing for mobile devices, releases, etc.). Today, I did a pull on the develop branch for the front-end, but it bombs out when I try to bring it back up.

I tried looking back in the commit history; obviously what I want to do is go back to the 1-2 month-old front-end so I can keep working. However, when I look at the history, I can't identify what commit I had been working off since the pull caused the project history to show the 50_ commits done by the development team since the version I was using.

How do I simply go back to where I was?

eSurfsnake
  • 647
  • 6
  • 17
  • 1
    Possible duplicate of [Undo git pull, how to bring repos to old state](https://stackoverflow.com/questions/1223354/undo-git-pull-how-to-bring-repos-to-old-state) – everton Sep 08 '18 at 04:10
  • As described on the answer I linked as dup, `git reflog` will tell you the commit hash you were before the pull and then `git reset ` will get you back to it. – everton Sep 08 '18 at 04:13

1 Answers1

0

The answer is to (1) look at the log and find the commit I wanted to reset to (suppose it's has starts with a2345678), and (2) use:

git reset --hard a2345678

This then undoes any and all changes since then, including (1) changes to local working files that were made since, and (2) changes that are staged for commit locally.

It is possible to not make the changes (1) and (2) by proper use of the switches '--soft' and '--mixed'. See the git manual pages for details.

But, in general, to get back to a prior commit with has a2345678, use:

git reset --hard a2345678
eSurfsnake
  • 647
  • 6
  • 17