Home > OS >  I am stuck in this branch in git
I am stuck in this branch in git

Time:01-25

So this is the error message! I am learning git and github from some time, and while learning I created a branch called "newbranch" now I am stuck in this branch. I wanna go back to my main or master branch and whenever I try to do that, the terminal always throws the same error. I am literally frustrated! I am stuck here for so long and I tried a lot but still no progress!

Basically I explained everything above please help your fellow brother out !

CodePudding user response:

Did you try this: git checkout branchYouWantToSwitch otherwise send your error message

CodePudding user response:

Try to first use the git checkout command. This will allow you to switch between different branches.

git checkout master 

This will switch you from "newbranch" to the master branch.

You can also use the git branch command to list all branches in your repository. This will help you to understand where you are and where you want to go.

If that doesn't work, you can also use the git reset command to reset your branch to the previous commit. This will allow you to switch back to the master branch without any errors.

git reset --hard origin/master 

You can also use the git revert command to undo the changes made in the new branch and revert back to the master branch.

git revert HEAD 
  • Related