问题
My design (html/css) changed/gone awry after I popped back stashed repo.
Here is what I did. In order to temporary try out something,
- I did a
git stash
- Then, checked onto an earlier commit
git checkout fd3243d
but did not make any changes. - Immediately did
git stash pop
.
Now, to my horror (that sinking feeling), when I refreshed design in browser it went totally awry and on the very top it reads
<<<<<<< Updated upstream ======= >>>>>>> Stashed changes <<<<<<< Updated upstream ======= >>>>>>> Stashed changes
Can anybuddy help me get back to the state pre first step i.e. before I did a git stash
?
I don't have any backup's and last commit was done quite a while back. I have a feeling that this can be done but don't know how since I am very new to git.
Can anybuddy help? Thanks dk
回答1:
Assuming you were on the master branch before follow these steps:
Check that your stashed changes are still in the stash. Git won't pop (remove) a stash that could not be applied cleanly
git stash list
For more detailed checks try:
git stash show stash@{<the-number-behind-your-stash>}
This should be the case (otherwise an edit to this answer will explain how to rescue your changes)
git reset --hard
back to master (or any other branch that your stash was created from). You can find out from which branch (or commit) your stash was created by looking at the output fromgit stash list
againgit stash pop
should now apply your changes cleanly and your changes are back
来源:https://stackoverflow.com/questions/38372745/design-goes-awry-after-checkout-to-earlier-commit-on-popping-stash