Git回版本回退
这里我们使用命令行的方式对已经提交的版本进行强行回退操作~~~
一、将git的安装目录bin放到path路径中,
如下图所示:

二、进入cmd界面,依次输入下面内容即可(git 远程仓库 回退到指定版本)
git checkout branches #检出当前分支
git branch branches_bak #备份相关分支
git reset --hard 版本号 #将本地代码强行回退到指定的版本号
git push -f origin branches #将本地分支强行push到远程分支上面
下面是我的相关执行操作,仅供参考:
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
D:\soft\devleop_tools\ideaUI\IntelliJ IDEA 14.1.3\workspace\fclient-git>git checkout branches
Already on 'branches'
Your branch is up-to-date with 'origin/branches'. D:\soft\devleop_tools\ideaUI\IntelliJ IDEA 14.1.3\workspace\fclient-git>git branch branches_bak
D:\soft\devleop_tools\ideaUI\IntelliJ IDEA 14.1.3\workspace\fclient-git>git reset --hard cfdbafc7
HEAD is now at cfdbafc 修改登录相关的配置 Warning: Your console font probably doesn't support Unicode. If you experience strange characters in the output, consider switching to a TrueType font such as Consolas! D:\soft\devleop_tools\ideaUI\IntelliJ IDEA 14.1.3\workspace\fclient-git>git reset --hard cfdbafc7
HEAD is now at cfdbafc 修改登录相关的配置 Warning: Your console font probably doesn't support Unicode. If you experience strange characters in the output, consider switching to a TrueType font such as Consolas! D:\soft\devleop_tools\ideaUI\IntelliJ IDEA 14.1.3\workspace\fclient-git>git push -f origin braches
error: src refspec braches does not match any.
error: failed to push some refs to 'http://***.com/app/**.git' D:\soft\devleop_tools\ideaUI\IntelliJ IDEA 14.1.3\workspace\fclient-git>git push -f origin branches
Username for 'http://***.com': zhanghao80
Password for 'http://zhanghao80@***.com':
Total 0 (delta 0), reused 0 (delta 0)
remote: Updating references: 100% (1/1)
To http://***.com/app/**.git
+ bfdb901...cfdbafc branches -> branches (forced update) D:\soft\devleop_tools\ideaUI\IntelliJ IDEA 14.1.3\workspace\fclient-git>
Thank is all ~~
Git回版本回退的更多相关文章
- Git(时光机-版本回退)
现在,你已经学会了修改文件,然后把修改提交到Git版本库,现在,再练习一次,修改readme.txt文件如下: Git is a distributed version control system. ...
- Git学习--版本回退
现在,你已经学会了修改文件,然后把修改提交到Git版本库,现在,再练习一次,修改readme.txt文件如下: Git is a distributed version control system. ...
- idea中git远程版本回退
idea中git远程版本回退 2017年10月15日 15:25:36 gomeplus 阅读数:19313 工作中遇到git远程仓库需要回退到历史版本的问题,根据网上的搜索结果结合自己的实践,整理了 ...
- git指令-版本回退
git指令-版本回退 回顾: 1. 修改文件 2. 添加到暂存区并提交 回顾对readme共三次修改: 1. 版本1:wrote a readme file Git is a version cont ...
- git远程版本回退
本文为博主原创,未经允许不得转载: 之前在git提交版本时,发现将新开发的代码提交到了另一个分支上,为了不影响提交分支代码的 功能,需要回退到之前的版本. 在使用命令回退的时候,一直没有回退成功,有个 ...
- Git之版本回退及回滚
应用场景 当开发某个项目时,会有多次提交记录,如A版本àB版本àC版本,假如目前处于C版本状态,我想回退到A版本,该如何操作:而当回退到A版本后,我又想回滚到B版本,又该如何操作,见下文分解!
- git的版本回退探索
简介 今天改完代码匆忙提交,上线发现有问题,那怎么办?废话,赶紧回滚,那怎么回滚,开始用git reset [--soft | --mixed | --hard 命令,但这命令真的能达到我预期的效果吗 ...
- [git 学习篇] git文件版本回退再学习
需求; 准备把readme.txt回退到上一个版本,也就是“add distributed”的那个版本 首先,Git必须知道当前版本是哪个版本,在Git中,用HEAD表示当前版本,也就是最新的提交3 ...
- git 远端版本回退
情景:本地更改推送远端后,想要回退到自己推送之前的某个版本. 比如想回退的分支为 test 分支. 风险:远端回退到某一版本后,之后的所有推送都没了(对应的日志记录也没了).如果是团队开发,不仅自己推 ...
随机推荐
- redis高级应用特征
Redis高级应用特性 1.安全性 2.主从复制 3.事务处理 4.持久化机制 5.发布订阅消息 6.虚拟内存的使用 安全性 设置客户端连接后进行任何其他指定前需要使用的密码. 警告:因为redis速 ...
- c# 处理js序列化时 datetime返回UTC格式的问题
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using Syst ...
- DIV css中cursor属性详解-鼠标移到图片变换鼠标形状 (转)
css中cursor属性详解-鼠标移到图片变换鼠标形状 语法: cursor : auto | all-scroll | col-resize| crosshair | default | han ...
- git pull时出现vim窗口的解决办法
最近常用到git来push代码到origin development分支上,也出现了几次vim窗口,防止忘记还是记录下来比较好: 首先按ESC键退出编辑状态,然后按shift+;键,再按wq!保存退出 ...
- [Python] 跳过前几行快速读取文件内容:islice
from itertools import islice start = 1 # 跳过第一行idx=0,从idx=1开始读取文件 with codecs.open('data.json', encod ...
- 读文件名,shell
参考文献:(忘了哪个笔记了)http://www.docin.com/p-871820919.html
- 新Eclipse安装与配置 【来源网络根据实际情况自己补充】
[第一次更新:20161108:http://blog.csdn.net/vvanity/article/details/51036678] Eclipse的官网地址:http://www.eclip ...
- POJ1733 Parity game 【带权并查集】*
POJ1733 Parity game Description Now and then you play the following game with your friend. Your frie ...
- BZOJ4521 Cqoi2016 手机号码 【数位DP】
Description 人们选择手机号码时都希望号码好记.吉利.比如号码中含有几位相邻的相同数字.不含谐音不吉利的数字等.手机运营商在发行新号码时也会考虑这些因素,从号段中选取含有某些特征的号码单独出 ...
- Sharepoint Web.config trust level="Full"权限说明
在SharePoint里面,不仅有用户的权限,还有代码的权限.比如,我们在安装一个自定义的WebPart的时候,默认的情况下是不能操纵文件夹的,如果你看一些教你怎么做WebPart的文章的话,你会发现 ...