git stash changes apply to new branch?

Question

I was working on master branch, made some changes and then stashed them. Now, my master is at HEAD.

But now, I want to retrieve these changes but to a new branch which branches from the HEAD version of the master branch.

How do i do this ?

Answer

Is the standard procedure not working?

  • make changes
  • git stash save
  • git branch xxx HEAD
  • git checkout xxx
  • git stash pop

Shorter:

  • make changes
  • git stash
  • git checkout -b xxx
  • git stash pop

Get the short Git version hash

How do I undo 'git add' before commit?