如何使用';git checkout';命令

如何使用';git checkout';命令,git,Git,我认为下面的这个命令将签出远程分支名称“branch\u name”,并为我创建一个名为“branch\u name”的本地分支 'git checkout -b branch_name "`git remote`"/branch_name' 我的问题是 尽管我已经有了一个分支名“branch\u name”,但我如何运行它呢?我可以让git it checkout甚至将分支名更改为branch\u name吗(如果该分支已经存在) 当我执行'git branch-a'时,我没有看到分支'r

我认为下面的这个命令将签出远程分支名称“branch\u name”,并为我创建一个名为“branch\u name”的本地分支

'git checkout -b branch_name "`git remote`"/branch_name'
我的问题是

  • 尽管我已经有了一个分支名“branch\u name”,但我如何运行它呢?我可以让git it checkout甚至将分支名更改为branch\u name吗(如果该分支已经存在)

  • 当我执行'git branch-a'时,我没有看到分支'remote/branch\u name',我只看到分支'remotes/ser git/branch\u name'。git如何从'git remtoe'/branch\u name中找到正确的remove分支

尽管我已经有一个分支名称“branch_name”,但我如何运行它, 我是否可以要求git it checkout到分支机构名称(如果该分支机构已经存在) 存在吗

使用
-B
选项代替
-B

当我执行'git branch-a'时,我没有看到分支'remote/branch_name', 我只看到一个分支“remotes/ser git/branch_name”。git如何找到 从'git remtoe'/branch\u name中删除右侧分支

git按以下顺序解析引用名称:

  • 如果存在
    $GIT\u DIR/
    ,这就是您的意思(这通常仅适用于
    头部
    提取头部
    原始头部
    合并头部
    樱桃头
  • 否则,
    refs/
    (如果存在)
  • 否则,
    refs/tags/
    (如果存在)
  • 否则,
    refs/heads/
    (如果存在)
  • 否则,
    refs/remotes/
    (如果存在)我建议使用git repo查看器提前签出分支。类似smartgit的东西。