当前位置: 首页 > 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.yayakq.cn/news/653959/

相关文章:

  • 灌云网站设计沈阳做网站的公司
  • 免费网站制作网站源码拓者设计吧效果图
  • 自己怎么来建设网站网站的标题优化怎么做
  • 模板网站哪家好wordpress手机端显示pc端
  • 淘宝客必须做网站wordpress 积分下载
  • 石家庄做网站费用网站建设对公司的发展
  • 怎样建一个免费网站网页设计与制作课程的建设历程
  • 专业的建设机械网站wordpress首页最新文章
  • 网站建设公司有多少家网站添加子域名
  • 建设标准 免费下载网站婚纱网站源码
  • 婚恋网站女孩子都是做美容模板网站的域名是什么意思
  • 响应式网站设计的优点网站建设确认函
  • 小程序制作方法教程襄阳seo技术
  • c2c模式的网站有哪些怎么样做seo
  • html5素材网站能打开所有网站的浏览器
  • 企业网站建设457网站开发时如何设计英文版本
  • 长沙网站设计培训机构人像摄影作品网站
  • 福鼎市建设局网站wordpress 清除cookie
  • 建筑网站 知乎做php网站方向要会什么
  • 滨湖区建设局网站上海的装修公司排名
  • 免费建网站可以找哪家英文网站支部建设杂志官方网站
  • 泰安微网站建设网页设计策划案范文
  • 贵阳百度做网站电话seo推广怎么学
  • 住房城乡建设部网站哪些网站可以做视频直播
  • 昆明网站制作公司没备案可以做网站么
  • 网站建设平台ui确认书网站建设算无形资产吗
  • 自建外贸网站上海做网站的公司
  • 上传了网站源码怎么做住房和城乡建设官网证书查询
  • phpmysql网站开发青岛网络推广的有哪些公司
  • 企业做网站应该注意的问题微信公众号自己微网站吗