I forgot to switch to a new branch before beginning my project, and now I need to push my changes to a new branch (not master) in order for another to review my work. My work is finsihed, but saved in my local master.
How can I move my changes into a new branch, so when I push it doesnt mess with the master branch but instead create a new remote branch ?
First, since you have done all your work your local master branch, create a new feature branch pointing to the tip or your local master.
$ git checkout -b newfeature master
and then leave the master as it is in the server (remote)
$ git checkout master
$ git reset --hard origin/master
Create a new branch at the same point as your master.
Checkout the master, and hard reset your current branch to the commit you want to rewind to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With