Git 相关命令问题
今天在仓库进行分支创建的时候提示如下错误:
warning: refname 'xxx_feature_3.0.6' is ambiguous.
fatal: ambiguous object name: 'xxx_feature_3.0.6'
当时很奇怪,因为本地和远端仓库都只有一个xxx_feature_3.0.6分支,没明白为什么会出现名称冲突。
这里用git命令继续查看本地的所有log记录
git show-ref | grep "xxx_feature_3.0.6"
看到三条相关的记录
7004bb7f84c584080a8ba85de8b4d49f60fbf72e refs/heads/xxx_feature_3.0.6
7004bb7f84c584080a8ba85de8b4d49f60fbf72e refs/remotes/origin/xxx_feature_3.0.
29493fc442cc6d62580559a57317b223ccaba393 refs/tags/xxx_feature_3.0.6
发现了有一个tag记录是xxx_feature_3.0.6
这里删除这个tag记录,并同步到远端
git tag -d xxx_feature_3.0.6
Deleted tag 'xxx_feature_3.0.6' (was 29493fc442)
git push origin :refs/tags/xxx_feature_3.0.6
remote: warning: Deleting a non-existent ref.
To http://git.xxxxx/xxxxxx/xxxxxx/ios/xxxxxx.git
- [deleted] xxx_feature_3.0.6
重新查看本地记录:
git show-ref | grep "xxx_feature_3.0.6"
7004bb7f84c584080a8ba85de8b4d49f60fbf72e refs/heads/xxx_feature_3.0.6
7004bb7f84c584080a8ba85de8b4d49f60fbf72e refs/remotes/origin/xxx_feature_3.0.
已经正常。
注意:
以后再次出现这个问题, 可以通过查看git本地日志记录来定位排查