Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does "git branch -a" list tags?

Tags:

git

I'm using git branch -a to list all my remote branches.

remotes/origin/feature1
remotes/origin/feature2
remotes/client/feature1
remotes/client/feature2

I pick one and checkout client/feature2 to it and that puts me in a detached head state which seems like I've checked out to a tag somewhere in history?

like image 863
TheMeaningfulEngineer Avatar asked May 16 '26 17:05

TheMeaningfulEngineer


1 Answers

Does "git branch -a" list tags?

No, it lists branches.


$ git checkout client/feature2

... puts me in a detached head state which seems like I've checked out to a tag somewhere in history?

But a remote branch does just point to a commit. You can't use it as a local branch, to check it out and work on it.

What you can do instead is create a local tracking branch and work on that - the remote branch is updated when you push.

$ git checkout -b feature2 client/feature2
like image 54
Useless Avatar answered May 18 '26 19:05

Useless



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!