Suppose my current branch is develop. I forgot to open a new branch before starting new requirements, so I started to modify it directly in the workspace. Halfway through writing, now I want to open a new branch named skin, and put The modifications in the workspace are transferred to the new branch, the modifications in my local develop workspace are cleaned up, and the work is switched to the new branch to continue. How to do it?
Just switch branches directly
Switch branches directly. Local modifications are not bound to the branch. The modifications you made after switching are still there.
git stash, then create a new branch locally and switch to the new branch, then execute git stash pop, you can try it, it should work
Create a new skin branch directly in your local area, and then switch directly to your skin branch