'git branch -av' は存在しないリモートブランチを表示します 質問する

'git branch -av' は存在しないリモートブランチを表示します 質問する

これはおそらく愚かな質問ですが、私は Git を初めて使用しており、もう存在しないリモート ブランチが表示されています。

$ git branch -a
* master
  remotes/origin/master
  remotes/origin/production

リモートに本番ブランチが存在するとは思えませんが、なぜローカルにまだ表示されているのかわかりません。このブランチを削除するにはどうすればよいですか? 削除の試みは次のようになります:

$ git push origin :production

error: unable to push to unqualified destination: production
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'git@IP:puppet.git'

リモートの本番ブランチをチェックアウトすることはできますが、次のような結果になります:

$ git checkout origin/production
Note: checking out 'origin/production'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at c323996... added powerdns module, no really

一体何をやっているのか全く分かりません。どなたか助けていただければ幸いです。

ベストアンサー1

あなたがしなければなりません:

git remote prune origin

おすすめ記事