pull master 遇到
error: cannot lock ref 'refs/remotes/origin/feature/lambda/dynamoDb': 'refs/remotes/origin/feature/lambda' exists; cannot create 'refs/remotes/origin/feature/lambda/dynamoDb'
source tree 提示
error: some local refs could not be updated; try running
'git remote prune origin' to remove any old, conflicting branches
會發生這個原因, 是因為 remote 端的 branch 已經被刪除了,所以造成跟本地端的 branch 不同步。prune
翻譯為修剪, 可以用這個指令來修剪本地的分支, 解決分支不同步的問題。
按照指示操作
git remote prune origin
查了一下文件
prune
Deletes all stale remote-tracking branches under .
These stale branches have already been removed from the remote
repository referenced by , but are still locally available in "remotes/".
With --dry-run option, report what branches will be pruned,
but do not actually prune them.
指令後半段的 origin
是 Git 自動替你將 remote 的 repository 命名為 origin
, 這個指令會自動修剪掉在 remote (origin) 上過期的分支。
加上 --dry-run
會列出哪些 branch 會被修剪。
沒有留言:
張貼留言