Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

git (CLI) won't let me switch branches

I have two branches in the local repository:

tools@secmgrprd02:~/src/dev/auth-monitoring$ git branch
  dev-mar-21
* master

as you see I am on master (I swapped back to check something).

when I try to switch back to the dev branch I get:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

tools@secmgrprd02:~/src/dev/auth-monitoring$ git checkout -b dev-mar-21
fatal: A branch named 'dev-mar-21' already exists.

As usual I am clearly missing something!

>Solution :

The -b option is a request to first create a new branch before switching to it. You want to switch to an existing branch, so -b is not needed.

git checkout dev-mar-21
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading