Git 版本管理之git神器版本回退(版本回退-已经提交到remote仓库)
起语:
版权声明: 腾讯课堂->零声学院.
我只是用来方便学习 && 复习!!! 我只是一个学习者, 从来不对我说过的话负责, 大家看到谨慎参考!!!
版本回退-已经提交到remote仓库
总结================================================================
具体操作
模拟场景
这是另外一个同事的提交
如果现在我想回滚到 红色矩形版本, 可是又能不影响其他同事的提交, 解决方案: 拉取分支
注意: 不能影响其他同事的提交. 只能影响自己的
查看我目前所在的分支
拉取我想要回滚的版本, 添加一个分支
查看我当前所在的分支
查看代码的内容
我也不知道这个操作有啥用
切换到 master 这个分支
查看代码内容
老师突然发现自己, 分支拉取错误了
老师忘记了(正常), 在尝试删除刚刚拉取的分支
老师忘记了(正常), 在尝试删除刚刚拉取的分支
这才是真真的删除刚拉取的分支
这次才是, 需要拉取的分支
-b #新建分支
reset_to_xxxxxxxx #分支名
xxxxx #分支的id
当前的分支就会到, 新建的分支上
查看代码
=========================================
拉取最近的代码, 注意左上角的位置
git log #查看日志
查看它之前做了那些修改, +printf(“add feature : #FT-1234566”);
vim main.cpp
git status #查看当前的状态
提交 commit
切换到 master 分支上
记得切换到 master分支
把 reset_to_f812621xxxx(分支)内容 merge 到master(分支)上
发现有冲突(这里提示是在main.cpp上)
vim main.cpp
需要手动修改冲突
commit #提交到本地仓库
push #上传到远程仓库
我也不知道这是什么操作
版本回滚, 是一件很危险的事情!!!
结语:
时间: 2020-08-18