博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
回退 服务器 上的 git 仓库 & 删除 服务器上的 git 分支
阅读量:4038 次
发布时间:2019-05-24

本文共 1698 字,大约阅读时间需要 5 分钟。

如果我们某次修改了某些内容,并且已经commit到本地仓库,而且已经push到远程仓库了?这种情况下,我们想把本地和远程仓库都回退到某个版本,该怎么做呢?

前面讲到的git reset只是在本地仓库中回退版本,而远程仓库的版本不会变化,这样,即时本地reset了,但如果再git pull,那么,远程仓库的内容又会和本地之前版本的内容进行merge,这并不是我们想要的东西,这时可以用 以下 方法来解决这个问题

#删除远程的xxx分支          git push origin :xxx

===============================

Here’s a solution if you ever get the following error when trying to delete the master branch in a remote repository:

remote: error: By default, deleting the current branch is denied, because the nextremote: error: 'git clone' won't result in any file checked out, causing confusion.remote: error: remote: error: You can set 'receive.denyDeleteCurrent' configuration variable toremote: error: 'warn' or 'ignore' in the remote repository to allow deleting theremote: 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/masterTo /somewhere/in/the/cloud/repo.git ! [remote rejected] master (deletion of the current branch prohibited)error: failed to push some refs to '/somewhere/in/the/cloud/repo.git'

The reason you’re seeing the error is that HEAD on the remote repository by default contains something like this (see also line 9 in the error message above):

ref: refs/heads/master

If you have access to the remote repository, simply modify the HEAD file to point to a different branch and then you’ll be able to delete the remote master branch. There are some significant implications to modifying the remote HEAD, especially if other users are tracking that branch, so make sure you know what you’re doing if you choose to point it to some other arbitrary branch.

转载地址:http://snpdi.baihongyu.com/

你可能感兴趣的文章
linux和windows内存布局验证
查看>>
linux insmod error -1 required key invalid
查看>>
linux kconfig配置
查看>>
linux不同模块completion通信
查看>>
linux printf获得时间戳
查看>>
C语言位扩展
查看>>
linux dump_backtrace
查看>>
linux irqdebug
查看>>
git 常用命令
查看>>
linux位操作API
查看>>
uboot.lds文件分析
查看>>
uboot start.s文件分析
查看>>
没有路由器的情况下,开发板,虚拟机Ubuntu,win10主机,三者也可以ping通
查看>>
本地服务方式搭建etcd集群
查看>>
安装k8s Master高可用集群
查看>>
忽略图片透明区域的事件(Flex)
查看>>
忽略图片透明区域的事件(Flex)
查看>>
AS3 Flex基础知识100条
查看>>
Flex动态获取flash资源库文件
查看>>
flex中设置Label标签文字的自动换行
查看>>