Home > Mobile >  Visual Studio: How to push changes to a new Branch?
Visual Studio: How to push changes to a new Branch?

Time:09-10

I have 100s of changes that I don't want to push to master. Usually I start a new branch, and then merge later.

How can I create a new branch without losing my current changes?

https://imgur.com/biUMNrB

CodePudding user response:

Just do

git stash -m "my awesome changes"

After creating a new branch, just apply

git stash apply --index 0

If you have other stashes, then make sure you use the right index.

CodePudding user response:

Using visual studio

  1. Commit your changes
  2. Create new branch (as shown in your image, but uncheck checkout branch)
  3. Right click the commit before -> reset -> hard reset -> ok (Now you are at the commit before, and your changes are in safe backup branch)
  4. Checkout your new backup branch -> push (this will create a new branch at origin side).
  • Related