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?
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
0 Asked on March 3, 2021 by riki
2 Asked on March 3, 2021 by kacper-floriaski
2 Asked on March 2, 2021 by tiago-machado
1 Asked on March 2, 2021 by davide
1 Asked on March 2, 2021 by chiahao
1 Asked on March 1, 2021
0 Asked on March 1, 2021 by silpi-mukherjee
1 Asked on March 1, 2021 by jean-philippe-m
1 Asked on March 1, 2021 by user504909
1 Asked on March 1, 2021 by bbarriatos
1 Asked on February 28, 2021 by piemol
2 Asked on February 28, 2021 by saisekiba
1 Asked on February 28, 2021 by moses-liao-gz
Get help from others!
Recent Questions
Recent Answers
© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP