Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push local commits on master branch to new remote branch

Tags:

git

branch

I have local commits on the master branch, but (due to unforeseen external reasons) I now can't push my changes to master and instead need to push them to a new remote branch (that can be merged back to master later).

How do I (safely) do that?

like image 593
Bohemian Avatar asked Sep 01 '25 02:09

Bohemian


1 Answers

Create a new branch:

git checkout -b myNewBranch

Push to repo:

git push
like image 120
Alex Pan Avatar answered Sep 02 '25 17:09

Alex Pan