【Git】Git ~ git remote prune ~

■ はじめに

小ネタ。

git pullした際に、エラー「error: some local refs could not be updated」が発生して
その際に「git remote prune origin」を実行して解決した(詳細は【0】参照)
そもそも、これなんだって思ったので、メモ。

目次

【0】トラブル:git pullした際に、エラーが発生
 1)エラー内容
 2)解決案
【1】git remote prune
【2】使用用途 (【0】の原因)

【0】トラブル:git pullした際に、エラーが発生

1)エラー内容

error: some local refs could not be updated; try running
 'git remote prune origin' to remove any old, conflicting branches

2)解決案

原因が後々で、、、
「git remote prune origin」を実行する
 => で、これって何?って思って調べてみた

【1】git remote prune

* ローカルリポジトリからリモートに存在しないブランチを削除する

cf. prune (プルーン)
 = 切り取る, 刈り取る,
 〔不要なもの・余分なものを〕取り除く, 削る
 〔費用を〕切り詰める

【2】使用用途 (【0】の原因)

ローカルリポジトリとリモートリポジトリで同期が取れておらず
ローカルリポジトリには存在するが、
リモートリポジトリに存在しないブランチを削除する場合

関連記事

Git ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2018/06/29/104028
Git ~ 基本編 / あれこれ ~
https://dk521123.hatenablog.com/entry/2018/07/01/005431