简体   繁体   English

“git branch -a”列表标签吗?

[英]Does “git branch -a” list tags?

I'm using git branch -a to list all my remote branches. 我正在使用git branch -a列出我所有的远程分支。

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? 我选择一个并checkout client/feature2到它,这使我处于一个detached head状态,似乎我已经检查了历史中的某个标签?

Does "git branch -a" list tags? “git branch -a”列表标签吗?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM