当前位置:网站首页>两种方法实现pycharm中代码回滚到指定版本(附带截图展示)
两种方法实现pycharm中代码回滚到指定版本(附带截图展示)
2022-06-25 13:35:00 【YZL40514131】
第一种方法:采用git命令操作
1、例如仓库中有下面的代码(版本1)

2、现在继续编写代码,并且提交到远程仓库中(版本2)

3、回退到版本1中
git reflog:查看所有的历史版本
git reset --hard 版本号:回退到指定的版本
此时代码已经回退到指定的版本了
4、在操作的时候可能会遇到合并分支时版本冲突问题
工作中需要商量,我保留的是左边的代码
第二种方法:采用pycharm操作
1、首先在我们需要回滚的py文件的空白处右键点击,然后在弹出的选项卡中选择Local History>>Show History,如图所示:
2、然后弹出如下图所示的对话框
3、代码的回滚只需在左侧栏中右键选中要回滚的版本,然后在弹出的小对话框中选择Revert即可,如下图所示:
4、回退成功后的提示
5、回退后的代码
6、此时代码处于工作区。需要提交到远程仓库中


边栏推荐
- 程序員為什麼要軟一點?
- Settings the PC must be turned on
- Suanli & NFT trading platform f3 The exclusive NFT project of XYZ, hash eagle, will be grandly launched
- Qt内存映射
- None of the MLIR Optimization Passes are enabled (registered 2)解决办法
- Windows下MySQL的安装和删除
- 超酷汇编教程-- 简明x86汇编语言教程(1)
- Table de hachage, conflit de hachage
- Deep parsing and implementation of redis stream advanced message queue [10000 words]
- 完整详细的汇编实验报告
猜你喜欢

英语中的九大词性与九大时态

Logistic Regression VS Linear Regression

The starting point for learning programming.

How to determine if a web worker has been created or closed

网络远程访问的方式使用树莓派

删库跑路、“投毒”、改协议,开源有哪几大红线千万不能踩?

Some knowledge of the initial C language

As a software testing engineer, how do you think to ensure software quality?

VGA display of de2-115 FPGA development board

Scope of ES6 variable
随机推荐
删库跑路、“投毒”、改协议,开源有哪几大红线千万不能踩?
Explanation of a textbook question
shell 变量 入门
QT memory mapping
sigmoid函数sigmoid求导
How to solve SQL import
Turtlebot+lms111+gmapping practice
When the input tag type is number, the input of E, e, -, + is blocked
go---- mgo
Nine parts of speech and nine tenses in English
JS prototype. slice. call(arguments); Convert pseudo array to array
程序员为什么要软一点?
How does hash eagle, the founder of equity NFT, redefine NFT and use equity to enable long-term value?
Windows下MySQL的安装和删除
深入理解深度神经网络背后的数学(Mysteries of Neural Networks Part I)
shell 字符串变量
Is it safe for Guosen Securities to open a stock account? Excuse me?
完整详细的汇编实验报告
Sigmoid function sigmoid derivation
BACnet gateway bl103 for building automation