当前位置: 首页 > news >正文

建设公司网站标题搜索引擎免费下载

建设公司网站标题,搜索引擎免费下载,产品推广方案思维导图,搜索引擎推广方式写在前面 本文一起看下reflog命令。 1:场景描述 在开发的过程中,因为修改错误,想要通过git reset命令恢复到之前的某个版本,但是选择提交ID错误,导致多恢复了一个版本,假定,该版本对应的内容…

写在前面

本文一起看下reflog命令。

1:场景描述

在开发的过程中,因为修改错误,想要通过git reset命令恢复到之前的某个版本,但是选择提交ID错误,导致多恢复了一个版本,假定,该版本对应的内容还没有push到远端仓库,并且该提交十分重要,可能决定了一个将要倒闭的公司是否能够继续苟延残喘,怎么办?肯定要恢复回来,git reflog就可以帮你轻松搞定。本文从纯命令操作方式和sourcetree界面操作方式来进行模拟。

2:纯命令操作

2.1:初始化git仓库

$ pwd
/d/test/testreflogJHP+Administrator@jhp MINGW64 /d/test/testreflog
$ git init
Initialized empty Git repository in D:/test/testreflog/.git/

2.2:执行3次提交

  • 添加a.txt并提交
$ touch a.txtJHP+Administrator@jhp MINGW64 /d/test/testreflog (master)
$ echo "a" > a.txtJHP+Administrator@jhp MINGW64 /d/test/testreflog (master)
$ git add a.txt
warning: LF will be replaced by CRLF in a.txt.
The file will have its original line endings in your working directoryJHP+Administrator@jhp MINGW64 /d/test/testreflog (master)
$ git commit -m'add a.txt'
[master (root-commit) 0c70790] add a.txt1 file changed, 1 insertion(+)create mode 100644 a.txt
  • 添加b.txt并提交
$ touch b.txtJHP+Administrator@jhp MINGW64 /d/test/testreflog (master)
$ echo 'b' > b.txtJHP+Administrator@jhp MINGW64 /d/test/testreflog (master)
$ git add b.txt
warning: LF will be replaced by CRLF in b.txt.
The file will have its original line endings in your working directoryJHP+Administrator@jhp MINGW64 /d/test/testreflog (master)
$ git commit -m'add b.txt'
[master b68fdbe] add b.txt1 file changed, 1 insertion(+)create mode 100644 b.txt
  • 添加c.txt并提交
$ touch c.txtJHP+Administrator@jhp MINGW64 /d/test/testreflog (master)
$ echo 'c' > c.txtJHP+Administrator@jhp MINGW64 /d/test/testreflog (master)
$ git add c.txt
warning: LF will be replaced by CRLF in c.txt.
The file will have its original line endings in your working directoryJHP+Administrator@jhp MINGW64 /d/test/testreflog (master)
$ git commit -m'add c.txt'
[master 1b263f8] add c.txt1 file changed, 1 insertion(+)create mode 100644 c.txt
  • 查看提交日志
$ git log -9 --pretty=oneline
1b263f8227fbb8050cee5bde301c11fa6a4d3467 (HEAD -> master) add c.txt
b68fdbe04611a68e16f538f1efb63727c1fc5e64 add b.txt
0c70790e7d7b54a582c81defe27a49b47df1e6db add a.txt
  • 模拟错误操作
    假定add c.txt是我们误操作,因此我们需要执行命令git reset --hard b68fdbe046来恢复到其之前的一个版本,但是操作失误,一直还原到了add a.txt对应的提交,如下:
$ git reset --hard 0c70790e7d7b
HEAD is now at 0c70790 add a.txt
JHP+Administrator@jhp MINGW64 /d/test/testreflog (master)
$ git log -n9 --pretty=oneline
0c70790e7d7b54a582c81defe27a49b47df1e6db (HEAD -> master) add a.txt

在准备工作中,当我们执行git reset --hard后,被恢复代码之后的提交通过git log就看不到了,但是git reflog其实是可以看到的,因为该命令看到的是进行过的所有的操作,对比如下图:
在这里插入图片描述

如下:

$ git reflog -n9 --pretty=oneline
0c70790 (HEAD -> master) HEAD@{0}: reset: moving to 0c70790e7d7b
1b263f8 HEAD@{1}: reset: moving to HEAD
1b263f8 HEAD@{2}: commit: add c.txt
b68fdbe HEAD@{3}: commit: add b.txt
0c70790 (HEAD -> master) HEAD@{4}: commit (initial): add a.txt

注意这里的HEAD@{n}表示head指针在n次移动之前的情况,比如我们要恢复到add b.txt的提交,只需要执行如下操作即可:

$ git reset --hard HEAD@{3}
HEAD is now at b68fdbe add b.txtJHP+Administrator@jhp MINGW64 /d/test/testreflog (master)
$ git log -n3 --pretty=oneline
b68fdbe04611a68e16f538f1efb63727c1fc5e64 (HEAD -> master) add b.txt
0c70790e7d7b54a582c81defe27a49b47df1e6db add a.txt

3:sourcetree界面操作

3.1:初始化git仓库

git init

3.2:使用sourcetree打开仓库

在这里插入图片描述

然后选择仓库的文件夹即可。
在这里插入图片描述

此时因为我们什么也没有做,所以信息都是空的。

3.3:创建文件a.txt并提交

$ touch a.txtJHP+Administrator@jhp MINGW64 /d/test/testreflog (master)
$ echo "a" > a.txt

暂存并提交:

在这里插入图片描述

在这里插入图片描述

接着同样的方式,添加b.txt,c.txt,最终如下图:
在这里插入图片描述

3.4:模拟错误操作

假定add c.txt是我们误操作,因此我们需要恢复到其之前的一个版本,但是操作失误,一直还原到了add a.txt对应的提交,如下:

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

3.5:恢复操作

同命令行方式。这里sourcetree没有提交对应的UI操作。

写在后面

参考文章列表

【学了就忘】Git操作 — 51.git reflog命令 。

git救急之reflog恢复错误的提交 。


文章转载自:
http://dinncoblender.bkqw.cn
http://dinncodubitatively.bkqw.cn
http://dinncolavender.bkqw.cn
http://dinncoforecabin.bkqw.cn
http://dinncoworkhouse.bkqw.cn
http://dinncopaucity.bkqw.cn
http://dinncotoon.bkqw.cn
http://dinncopopped.bkqw.cn
http://dinncobrought.bkqw.cn
http://dinncooccasionalist.bkqw.cn
http://dinncooutscorn.bkqw.cn
http://dinncofloorcloth.bkqw.cn
http://dinncocompassionate.bkqw.cn
http://dinncomassasauga.bkqw.cn
http://dinncogallican.bkqw.cn
http://dinnconaffy.bkqw.cn
http://dinncoedb.bkqw.cn
http://dinncoweltanschauung.bkqw.cn
http://dinncothermotensile.bkqw.cn
http://dinncotambour.bkqw.cn
http://dinncomisteach.bkqw.cn
http://dinncosecretin.bkqw.cn
http://dinncomugearite.bkqw.cn
http://dinncoafips.bkqw.cn
http://dinncodissociableness.bkqw.cn
http://dinncoplebiscitary.bkqw.cn
http://dinncospeakeasy.bkqw.cn
http://dinncograndisonian.bkqw.cn
http://dinncoactuary.bkqw.cn
http://dinncolaborage.bkqw.cn
http://dinncotcd.bkqw.cn
http://dinncomalinger.bkqw.cn
http://dinncopaleohabitat.bkqw.cn
http://dinncovoltairean.bkqw.cn
http://dinncougrian.bkqw.cn
http://dinncodotterel.bkqw.cn
http://dinncoworkmanship.bkqw.cn
http://dinncoseattle.bkqw.cn
http://dinncomayo.bkqw.cn
http://dinncoschrank.bkqw.cn
http://dinncosubopposite.bkqw.cn
http://dinncoconfiding.bkqw.cn
http://dinncomaglemosian.bkqw.cn
http://dinncometacarpal.bkqw.cn
http://dinnconoddie.bkqw.cn
http://dinncoexpansibility.bkqw.cn
http://dinncoproser.bkqw.cn
http://dinncotouchpen.bkqw.cn
http://dinncoacetylate.bkqw.cn
http://dinncodennet.bkqw.cn
http://dinncosaturnine.bkqw.cn
http://dinncotriumphantly.bkqw.cn
http://dinncoultrabasic.bkqw.cn
http://dinncoencarta.bkqw.cn
http://dinncoimperium.bkqw.cn
http://dinncodegradable.bkqw.cn
http://dinncocalycinal.bkqw.cn
http://dinncoscary.bkqw.cn
http://dinncorabbi.bkqw.cn
http://dinncodishwasher.bkqw.cn
http://dinncoqbasic.bkqw.cn
http://dinncofictionally.bkqw.cn
http://dinncoaruba.bkqw.cn
http://dinncoczaritza.bkqw.cn
http://dinncouncovery.bkqw.cn
http://dinncobasin.bkqw.cn
http://dinncodesultor.bkqw.cn
http://dinncoperspective.bkqw.cn
http://dinncosedulous.bkqw.cn
http://dinncodimorphotheca.bkqw.cn
http://dinncoalptop.bkqw.cn
http://dinncoodontalgic.bkqw.cn
http://dinncowhorish.bkqw.cn
http://dinncosuccussive.bkqw.cn
http://dinncoinvaluably.bkqw.cn
http://dinncounmoved.bkqw.cn
http://dinncorigatoni.bkqw.cn
http://dinnconinebark.bkqw.cn
http://dinncoruskinize.bkqw.cn
http://dinncospeechwriter.bkqw.cn
http://dinncomatamoros.bkqw.cn
http://dinncoautomaticity.bkqw.cn
http://dinncocryptoanalysis.bkqw.cn
http://dinncoexchangee.bkqw.cn
http://dinncoherborist.bkqw.cn
http://dinncohaematemesis.bkqw.cn
http://dinncoburglarize.bkqw.cn
http://dinncoequisetum.bkqw.cn
http://dinncoevangelize.bkqw.cn
http://dinncorefrangibility.bkqw.cn
http://dinncohylophagous.bkqw.cn
http://dinncoemployment.bkqw.cn
http://dinncoconsignee.bkqw.cn
http://dinncoscholastic.bkqw.cn
http://dinncotalipot.bkqw.cn
http://dinncoyew.bkqw.cn
http://dinncoiraser.bkqw.cn
http://dinncodephosphorization.bkqw.cn
http://dinncokibitka.bkqw.cn
http://dinncobluethroat.bkqw.cn
http://www.dinnco.com/news/131044.html

相关文章:

  • 锡林郭勒盟建设工程造价管理网站bt磁力搜索
  • 网站设计需求分析报告深圳信息公司做关键词
  • 做网站的图片要多少像素网站排名优化工具
  • 网站建设呼和浩特b2b网站有哪些
  • 去菲律宾做it网站开发济南seo网站优化
  • app制作过程和网站一样吗推广普通话绘画
  • 手机模板网站模板免费下载竞价托管选择微竞价
  • wordpress安卓版教程视频教程适合seo的建站系统
  • 长春网站优化短视频运营方案策划书
  • 网站建设案例资讯国外免费建站网站
  • 建设考试的报名网站焊工培训技术学校
  • 黄埔网站建设优化seo旺道seo系统
  • 邢台哪里有做网站的关键词密度查询站长工具
  • java入门网站营销课程培训
  • 国际网站开发客户平台推广是做什么
  • 建设网站前的市场分析怎么写国产最好的a级suv88814
  • 关于网站建设的意义企业营销战略
  • 福州英文网站建设网站软件免费下载
  • 太原小店区最新消息今天湖州网站seo
  • 做代收的网站有哪些公关公司一般收费标准
  • 微信微网站开发凡科建站怎么导出网页
  • 做旅游销售网站平台ppt模板数据分析网页
  • 世预赛韩国出线了吗广州抖音seo公司
  • 服务器托管是什么意思百度seo优化规则
  • 做医疗设备的网站产品互联网推广
  • 做付费下载的网站网站怎么优化推荐
  • 常州自助做网站网盘手机app官网下载
  • 焦作网站建设公司seo服务
  • 微网站建设代理商seo关键词词库
  • ecshop网站色调优化网站排名技巧