Git create new branch from current - create git branch with current changes
I started working on my master branch thinking that my task would be easy. After a while, I realized it would take more work and I want to do all this work in a new branch.
How can I create a new branch from current and take all these changes with me without dirtying master?
To resolve this issue use:
git checkout -b topic/newbranch
Any uncommitted work will be taken along to the new branch.
If you try to push this to the repo then you will get a message and it shows how to resolve the issue.
fatal: The current branch feature/NEWBRANCH has no upstream branch. To push the current branch and set the remote as upstream, use
git push --set-upstream origin feature/feature/NEWBRANCH
Then follow the same then you can git create new branch from current changes