Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've been working on branch A. My work there is not finished, but I need to switch to branch B for a while. It looks like stash is the command to use. I've found a number of references showing how to use stash to save your changes, but I'm a bit confused. All of the references say something like, when you're ready to go back, just do git stash pop. They don't, however, tell me if I need to switch back to branch A before doing that, though.

So, do I manually go back to branch A before running stash pop, or do I stay in branch B, and the actual act of running stash pop will send me back to branch A where I left off with it?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Using git stash pop will apply the stashed changes to the code that you currently have checked out. So if you want to apply them to your original branch, you'd need to checkout that branch before popping the stash.

share|improve this answer
    
Thank you. That's what made sense to me, but none of the guides I found said it explicitly, so I wasn't sure. –  EmmyS Dec 5 '12 at 16:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.