Design goes awry, after checkout to earlier commit on popping stash

孤街醉人 提交于 2019-12-10 20:24:43

问题


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,

  1. I did a git stash
  2. Then, checked onto an earlier commit git checkout fd3243d but did not make any changes.
  3. 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 from git stash list again

  • git 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!