Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 2 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .