Reputation: 401
I started doing work in master - many changes later (no commits) I realized that this work should be done in a separate branch.
Can I create a new branch with my current changes, then discard the changes in master back to its pristine state?
Thanks
Upvotes: 5
Views: 993
Reputation: 401
I figured it out.
while on master:
git branch [new-branch]
git checkout [new-branch]
...continue editing - in my case I committed them...
git add .
git commit -am 'updates'
switch back to master
git checkout master
Branch was in original state before I started making all the changes...
Hope this helps somebody else!
Upvotes: 4