[Git] error: cannot lock ref ‘refs/remotes/origin/xxx’: ‘refs/remotes/origin/xxx/yyy’ exists; の解決方法

git で error: cannot lock ref ‘refs/remotes/origin/xxx’: ‘refs/remotes/origin/xxx/yyy’ exists; というエラーを解決する方法をご紹介します。

Git

error: cannot lock ref ‘refs/remotes/origin/xxx’: ‘refs/remotes/origin/xxx/yyy’ exists;

$ git fetch
error: cannot lock ref 'refs/remotes/origin/fix-test': 'refs/remotes/origin/fix-test/hoge' exists; cannot create 'refs/remotes/origin/fix-test'
 ! [new branch]      fix-test/hoge -> origin/fix-test/hoge  (unable to update local ref)
error: some local refs could not be updated; try running
 'git remote prune origin' to remove any old, conflicting branches

解決方法 git remote prune origin

git remote prune origin

以上、 git で error: cannot lock ref xxx exists; エラーを解決したい、現場からお送りしました。

参考情報