On Jul 18, 8:19 pm, Roddie Grant <rod...@myword.co.uk> wrote: > I discovered this afternoon a long-forgotten stash. I pop-ed it and now I > have lots of merge conflicts. > > I'm finding it difficult to grasp the order of events. If I have: > > <<<<<<< Updated upstream > Code block A > ======= > Code block B > > >>>>>>> Stashed changes > > Does that means that Code block A are the changes made after the stash, and > Code block B are the changes which were uncommitted at the time the stash > was made?
You can think of stashing this way: when you stash, Git generates a patch file which contains the differences your work tree had compared to the HEAD, and then removes all the changes in the work tree (essentially, what `git reset --hard HEAD` does). Then you start hacking and make certain commits, promoting the HEAD and changing the state of the working tree. They you eventually apply your stash. Recall that the stashed "patch" was generated against the HEAD at the time of the stash, and it's applied on the working tree which might diverge from that state of the HEAD (and the HEAD itself might have diverged if you did at least one commit). Hence, what you're seeing is this: * "Updated upstream" means "these changes are in the working tree, compared to the state of the HEAD at the time you stashed your changes". * "Stashed changes" means "the changes made in the working tree just before stashing, compared to the state of the HEAD at the time you stashed your changes". So, presumably you should stop thinking in terms of ordering of events and imagine applying patch files instead. -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-us...@googlegroups.com. To unsubscribe from this group, send email to git-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.