I have a “dev” git branch. I made some code changes locally. I haven’t committed them to the remote “dev” branch. Now that I’m halfway through the changes, I don’t want to commit the local changes to same remote branch. I’d like to create a new branch called “over_here” and commit the changes there.
How can this be accomplished?
Assuming that your remote has standard git name
origin:Depending on if you need to reset your
devbranch back toorigin/devstate you could also executeUPDATE: Above was written assuming you have some changes commited. As you told in comments that you didn’t commit anything to local
devbranch – you need to checkout new branch right now:Now your changes still here, but you’re on the newly created branch. So you’re ready to commit your local changes:
Now these changes are in your local repo only. If you want to push them into remote repository (probably github) – you should execute:
It will create new branch in the remote repository and commit your changes there.