本地删除无效的远程分支
2015-06-30 13:24
369 查看
hi all:
如何让已经失效的远程 branch-name 在执行
有同事push 了一个git分支,并且被我给pull 到本地了
同事在自己机器上执行了
我在自己机器执行
error: unable to delete 'branch-name': remote ref does not exist
error: 无法推送一些引用到 'git@gitserver:phplib'
大家帮忙想想办法让已经失效的远程 branch-name 在执行
reply:
git remote prune origin
清理远程分支,把本地不存在的远程分支删除
删除了远程的master分支后,客户机再pull代码可能会有问题,提示默认的分支指向了不存在的ref。可参考下面的办法解决:
删除一个远程分支时出现错误提示:
remote: error: By default, deleting the current branch is denied, because the next
remote: error: 'git clone' won't result in any file checked out, causing confusion.
remote: error:
remote: error: You can set 'receive.denyDeleteCurrent' configuration variable to
remote: error: 'warn' or 'ignore' in the remote repository to allow deleting the
remote: error: current branch, with or without a warning message.
remote: error:
remote: error: To squelch this message, you can set it to 'refuse'.
remote: error: refusing to delete the current branch: refs/heads/foobar
To cisvr:~/reis.git
! [remote rejected] foobar (deletion of the current branch prohibited)
error: failed to push some refs to 'cisvr:~/reis.git'
也就是foobar是远程仓库的当前分支(由于使用
这样就将裸仓库的当前分支切换为devel分支,删除foobar分支就没问题了。
这个命令实质上是修改了.git/HEAD文件,使其内容为:
如何让已经失效的远程 branch-name 在执行
git branch -a的时候不再展示?
有同事push 了一个git分支,并且被我给pull 到本地了
同事在自己机器上执行了
git branch -d branch-name
git push origin :branch-name
我在自己机器执行
git branch -d branch-name//ok
git push origin :branch-name//提示:
error: unable to delete 'branch-name': remote ref does not exist
error: 无法推送一些引用到 'git@gitserver:phplib'
大家帮忙想想办法让已经失效的远程 branch-name 在执行
git branch -a的时候不再展示吧?谢谢
reply:
git remote prune origin
清理远程分支,把本地不存在的远程分支删除
删除了远程的master分支后,客户机再pull代码可能会有问题,提示默认的分支指向了不存在的ref。可参考下面的办法解决:
删除一个远程分支时出现错误提示:
remote: error: 'git clone' won't result in any file checked out, causing confusion.
remote: error:
remote: error: You can set 'receive.denyDeleteCurrent' configuration variable to
remote: error: 'warn' or 'ignore' in the remote repository to allow deleting the
remote: error: current branch, with or without a warning message.
remote: error:
remote: error: To squelch this message, you can set it to 'refuse'.
remote: error: refusing to delete the current branch: refs/heads/foobar
To cisvr:~/reis.git
! [remote rejected] foobar (deletion of the current branch prohibited)
error: failed to push some refs to 'cisvr:~/reis.git'
也就是foobar是远程仓库的当前分支(由于使用
git clone --bare生成裸仓库造成的),因为远程仓库是裸仓库,所以不能使用普通的git checkout命令切换分支。在裸仓库中使用如下命令来切换当前分支:
相关文章推荐
- HDU 3015 Disharmony Trees 【 树状数组 】
- SAT数学常见考点解析之概率
- Objective-C程序设计第10章---More on Variable and Data Types
- linux设置tomcat开机自动启动
- 介绍GRE填空技巧之词项释义法
- Android音频系统之AudioTrack(一)
- 漫谈 iOS Crash 收集框架
- sqoop-1.4.4 编译hbase-0.99.2版本
- 透明状态栏
- spring源码初步学习-自己实现的ioc容器结构
- solr4.7中文分词器(ik-analyzer)配置
- 04 基本元素 进制转换
- Xcode的控制台调试命令
- delphi 截图简单的实现
- 使用AudioTrack进行音频播放
- python
- hdu2191 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活
- PL/SQL8.0 注册码
- 涨停板联盟7月1日分享。
- device_create,device_create_file