AnswerBun.com

How do I switch from a merged branch to an new branch?

Stack Overflow Asked by mohammad-23 on January 3, 2022

I accidentally started working on a merged branch, now I want go back to develop get the updated code and then create a new branch. Is it possible to do so, or is there a workaround?

2 Answers

Use the following commands:

git stash: It will stash your uncommited changes.

git checkout develop: Go to develop branch

git pull: Get the latest code

git checkout -b "new branch" : Create a new branch

git stash apply : It will add your uncommited changes made in the step 1

Answered by Chakreshwar Sharma on January 3, 2022

if you wanna undo commits check this: How do I undo the most recent local commits in Git?

if you just want to change branch and create a new branch run this in terminal:

git checkout -b (write the name you want)

by running this you will create a new branch and also will switch to it.

Answered by Eliftch on January 3, 2022

Add your own answers!

Related Questions

How to center a flex container but left-align flex items

7  Asked on December 22, 2021 by etienne-nol

     

about IComponentConnector2

0  Asked on December 22, 2021 by yushang

   

WooCommerce order again and custom item data for price calculation

1  Asked on December 22, 2021 by elizabeth-parodi-roman

         

ruby how to stop the execution after rescue

1  Asked on December 22, 2021 by jill448

     

LSTM predicting constant value throughout

0  Asked on December 22, 2021 by harrys

         

Use main scrollbar to scroll all elements in the page

1  Asked on December 22, 2021 by marsilinou-zaky

         

How to read file from createReadStream in Node.js?

3  Asked on December 22, 2021 by ton1

   

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir