Take all my changes on the current branch and move them to a new branch in Git

Viewed 32026

I started work on what I thought would be a minor bug fix on my master branch. However, it has spiraled out of control to the point where I wish I had created a separate branch to do the development in the first place.

So right now what I'd like to do is:

  1. Create a new branch called (say) "edge"
  2. Move all the changed / untracked files on master to edge (such that master is unchanged from when I started the bug fix)
  3. Finish my work on edge, merge back into master

How can I do this?

3 Answers
Related