git 强制回退到指定版本
2023-02-18 16:31:20 时间
在工作中,有时候,我们需要强制回退到指定位置。命令:
假设现在commit的id是564564f489465465d45ec
需要回退的commit的id是:8f23b7e81331c404cf26
回退命令:
git reset --hard 8f23b7e81331c404cf26
强制提交:
git push -f -u origin master
如果在提交的时候出现如下错误:
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to xxxx.如下图:
问题产生原因:因为master是被保护的。
master被保护了,就不允许这种操作了。
解决方案:
登录git(需要有权限的人登录才可以),选择对应的项目,点击【setting】
选择[Protected Branches];
解除[master]的保护即可;
push完代码之后,再把[master]Protect起来即可;
切记:push完代码之后,再把master,protect起来。切记,切记!!
相关文章
- Linux NTP工具的基本使用
- Linux 系统环境监测
- Linux I/O模型
- Linux Lvs的防火墙标记
- linux LVS的DR模式多网段
- linux LVS的DR模式实现
- Linux LVS-NAT模式的实现
- linux IPtables的匹配条件
- linux IPtables 规则的管理
- Linux IPtables相关概念
- Linux 使用ipvsadm管理LVS
- Linux LVS的调度算法
- Linux LVS的四种工作模式
- Linux 集群和分布式相关概念
- Linux 会话管理
- Linux sersync + rsync 实现实时数据同步
- Linux 利用inotify和rsync服务实现数据实时同步
- Linux SAMBA 服务-cifs文件系统的挂载
- Linux NFS服务
- Linux FTP传输协议