It can be done in Visual Studio. Here are the steps:
- First make sure you don't have any pending changes. (Stash, commit, or undo them.)
- Right click on your checked out branch and choose "New Local Branch From..."
- Enter in the name of your new branch, but uncheck "Checkout branch".
- Now "View History" on your current branch.
- In the history view, right click on the commit you want to reset to. This would be the commit just before your first commit that you intended to add to the new branch. Select "Reset --> Delete Changes (--hard)".
- Now checkout your new branch.
You now will be in the exact same situation as if you created the new branch in the first place.
Side note: I do recommend learning how to do this from the command line rather than using the GUI. Once you know it, it's faster, easier, doesn't tie you to any particular UI, and enables you to script your favorite workflows more easily. As an example, here's the same workflow from the command line:
- First make sure you don't have any pending changes. (Stash, commit, or undo them.)
git branch new-branch-name
# create new branch like what's checked out now
git reset --hard HEAD~1
# go back one commit (change 1 to however many you need)
git checkout new-branch-name