user2602252
user2602252

Reputation:

Git: Convention over Configuration principle?

I know the basic Git but here I have an existing branch as remotes/origin/aditya. How do I switch to that?

 git branch -a

* (HEAD detached at origin/aditya1)
remotes/origin/master
remotes/origin/aditya-design
remotes/origin/aditya1
remotes/origin/aditya2

I know normally we do git checkout branch-name
but here I am unable to change and set my branch to

remotes/origin/aditya1

Thanks in advance

Upvotes: 0

Views: 67

Answers (1)

murraybo
murraybo

Reputation: 973

Remote branches are only references. If you checkout you will create a new local branch that starts were your HEAD was at that moment (in you case the detached origin/aditya1.

You probably want to do something similar to

git checkout -b aditya1 -t origin/aditya1

And than work on this newly created local branch.

Upvotes: 1

Related Questions