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

手机网站如何建设如何购买域名

手机网站如何建设,如何购买域名,加强网站党建建设,石家庄新闻最新一.问题描述 当我们在操作中手误删除了某个分支,那该分支中提交的内容也没有了,我们可以利用git reflog这个命令来查看历史提交的记录从而恢复被删除的分支和提交的内容 二.模拟问题 1.创建git仓库,并提交一个文件 [rootcentos7-temp /da…

一.问题描述

当我们在操作中手误删除了某个分支,那该分支中提交的内容也没有了,我们可以利用git reflog这个命令来查看历史提交的记录从而恢复被删除的分支和提交的内容

二.模拟问题

1.创建git仓库,并提交一个文件

[root@centos7-temp /data]# git init
已初始化空的 Git 仓库于 /data/.git/
[root@centos7-temp /data]# vim test.txt[root@centos7-temp /data]# cat test.txt 
11111
[root@centos7-temp /data]# git add test.txt
[root@centos7-temp /data]# git commit -m "first commit"
[master(根提交) af8a35f] first commit1 file changed, 1 insertion(+)create mode 100644 test.txt

2.再次编辑test.txt文件并提交

[root@centos7-temp /data]# vim test.txt [root@centos7-temp /data]# cat test.txt 
11111
22222
[root@centos7-temp /data]# git add test.txt 
[root@centos7-temp /data]# git commit -m "second commit"
[master 9f10533] second commit1 file changed, 1 insertion(+)

3.查看当前所处分支和提交记录

#可以看到所处分支是在master分支,在master分支中有两条提交记录

[root@centos7-temp /data]# git branch
* master[root@centos7-temp /data]# git log
commit 9f105338768642dd9306f4e0d83897847894176a (HEAD -> master)
Author: zhanghongshun <748749875@qq.com>
Date:   Sun Feb 12 14:55:48 2023 +0800second commitcommit af8a35fd2647b15059297c4d18d18de89f14601b
Author: zhanghongshun <748749875@qq.com>
Date:   Sun Feb 12 14:52:58 2023 +0800first commit

4.创建并切换至新分支

[root@centos7-temp /data]# git checkout -b main
切换到一个新分支 'main'

5.查看当前所处分支

[root@centos7-temp /data]# git branch
* mainmaster

6.在main分支上继续编辑test.txt文件并提交

[root@centos7-temp /data]# vim test.txt [root@centos7-temp /data]# cat test.txt 
11111
22222
33333
[root@centos7-temp /data]# git add test.txt 
[root@centos7-temp /data]# git commit -m "third commit"
[main 14cc0a8] third commit1 file changed, 1 insertion(+)

7.查看提交记录

[root@centos7-temp /data]# git log
commit 14cc0a8bc11ddb183d15241858108da85507d13c (HEAD -> main)
Author: zhanghongshun <748749875@qq.com>
Date:   Sun Feb 12 15:06:10 2023 +0800third commitcommit 9f105338768642dd9306f4e0d83897847894176a (master)
Author: zhanghongshun <748749875@qq.com>
Date:   Sun Feb 12 14:55:48 2023 +0800second commitcommit af8a35fd2647b15059297c4d18d18de89f14601b
Author: zhanghongshun <748749875@qq.com>
Date:   Sun Feb 12 14:52:58 2023 +0800first commit

8.切换到master分支下,然后删除main分支

[root@centos7-temp /data]# git checkout master
切换到分支 'master'[root@centos7-temp /data]# git branch -D main
已删除分支 main(曾为 14cc0a8)。

9.查看所有分支,验证下main分支是否真的被删除了

[root@centos7-temp /data]# git branch
* master

10.查看提交记录

#分支因为没有合并到master分支,就被删除了。所以此时master分支没有main分支上做的新的修改记录

[root@centos7-temp /data]# git log
commit 9f105338768642dd9306f4e0d83897847894176a (HEAD -> master)
Author: zhanghongshun <748749875@qq.com>
Date:   Sun Feb 12 14:55:48 2023 +0800second commitcommit af8a35fd2647b15059297c4d18d18de89f14601b
Author: zhanghongshun <748749875@qq.com>
Date:   Sun Feb 12 14:52:58 2023 +0800first commit

三.恢复main分支

1.查看所有分支的操作记录,对比之前在main分支查看的提交记录

 

 2.根据main的最后一次提交记录来恢复main分支

[root@centos7-temp /data]# git checkout -b main 14cc0a8
切换到一个新分支 'main'[root@centos7-temp /data]# git branch
* mainmaster[root@centos7-temp /data]# git log
commit 14cc0a8bc11ddb183d15241858108da85507d13c (HEAD -> main)
Author: zhanghongshun <748749875@qq.com>
Date:   Sun Feb 12 15:06:10 2023 +0800third commitcommit 9f105338768642dd9306f4e0d83897847894176a (master)
Author: zhanghongshun <748749875@qq.com>
Date:   Sun Feb 12 14:55:48 2023 +0800second commitcommit af8a35fd2647b15059297c4d18d18de89f14601b
Author: zhanghongshun <748749875@qq.com>
Date:   Sun Feb 12 14:52:58 2023 +0800first commit
http://www.khdw.cn/news/43463.html

相关文章:

  • 网站开发轮播图系统清理优化工具
  • 网站建设的英语惠州seo公司
  • 孝感网站建设最新的疫情信息
  • 外贸公司几个网站山东疫情最新情况
  • 如何做百度网站网店怎么运营和推广
  • 如何让wordpress主页不显示文章seo怎么优化关键词排名
  • 广州网站推广解决方案跨境电商关键词工具
  • 网站将导航条不滚动怎么做免费建站
  • 做电商网站的步骤上海网站外包
  • 一般做网站是用什么语言开发的sem竞价培训
  • 手机网站开发成为小程序微信加人推码35一单
  • 临安农家乐做网站百度大数据查询平台
  • 用什么系统做威客网站服务器租用
  • 动易网站后台管理系统免费的网站推广在线推广
  • 设计师常用网站关键词完整版免费听
  • 怎样做电子商务网站廊坊网站建设优化
  • 企业网站开发需求分析杭州做seo的公司
  • 做网站记者好吗seo关键词分类
  • 企业网站大图廊坊网站建设公司
  • 青岛专业制作网站的公司海洋网络推广效果
  • 学网站开发需要学那些seo搜索引擎优化平台
  • 手机网站建设定制长沙县网络营销咨询
  • wordpress怎么搭建美女图库模板福州seo代理计费
  • 电子商务网站建设与管理的总结地推团队去哪里找
  • 做网站公司的未来腾讯广点通广告投放平台
  • 哪个网站上网好推广普通话宣传语
  • 36岁了初中毕业想提升学历上海seo
  • 浙江小九天建设集团网站网站制作公司怎么样
  • 怎样找素材做网站厦门网
  • 外贸营销员国家职业技能标准福建seo关键词优化外包