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

学校做网站方案网站功能项目报价

学校做网站方案,网站功能项目报价,百度云搜索引擎入口百度网盘,免费制作企业网站平台文章目录 一、分离头指针二、创建分支三、比较commit内容四、总结 一、分离头指针 正常情况下#xff0c;在通过git checkout命令切换分支时#xff0c;在命令后面跟着的是分支名#xff08;例如master、temp等#xff09;或分支名对应commit的哈希值。 非正常情况下在通过git checkout命令切换分支时在命令后面跟着的是分支名例如master、temp等或分支名对应commit的哈希值。 非正常情况下git checkout切换分支时后面跟了一个非分支对应commit的哈希值此时就会产生分离头指针问题。 例如项目的版本历史中有如下3次commit其中两个分别是temp分支和master分支此时将分支切换到第三个commit也就是非temp、master分支上就会出现detached HEAD提示即分离头指针问题。 git log commit e5d60c7d913d427b2e2161f717dff97249dd1f9b (HEAD - temp) Author: xxx xxx163.com Date: Thu Nov 9 10:22:51 2023 0800add temp_testcommit 01df9fd5e046f104312468746168b027f4285c5c (master) Author: xxx xxx163.com Date: Thu Nov 9 10:22:04 2023 0800add file1commit db2d096bf27e4e8f4ca42e8b185e973b05e186df Author: xxx xxx163.com Date: Thu Nov 9 10:21:31 2023 0800add readme切换到非分支的commit上git就会提示当前处在detached HEAD分离头指针状态 git checkout db2d096bf27e4e Note: switching to db2d096bf27e4e.You are in detached HEAD state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch.If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example:git switch -c new-branch-nameOr undo this operation with:git switch -Turn off this advice by setting config variable advice.detachedHead to falseHEAD is now at db2d096 add readme此时HEAD指针并未在某个分支旁边即头指针与分支分离了 git log --all commit e5d60c7d913d427b2e2161f717dff97249dd1f9b (temp) Author: xxx xxx163.com Date: Thu Nov 9 10:22:51 2023 0800add temp_testcommit 01df9fd5e046f104312468746168b027f4285c5c (master) Author: xxx xxx163.com Date: Thu Nov 9 10:22:04 2023 0800add file1commit db2d096bf27e4e8f4ca42e8b185e973b05e186df (HEAD) Author: xxx xxx163.com Date: Thu Nov 9 10:21:31 2023 0800add readme 二、创建分支 当切换到某个commit时git会提示已进入到分离头指针状态并显示在该状态下可进行的操作 a可在该HEADcommit中进行测试、提交或取消更改当切回到分支时不会影响到分支但此前在此commit上做的所有操作都会丢失 b若想保留在该commit上的变动可通过git switch -c branch_name进行分支添加 分离头指针指向某个commit后若再切换回master分支或其他分支时没有为该commit新建分支则所有在该commit上做的操作都将丢失。 1在commit上进行修改操作并进行commit提交 vi readmegit status HEAD detached at db2d096 Changes not staged for commit:(use git add file... to update what will be committed)(use git restore file... to discard changes in working directory)modified: readmeno changes added to commit (use git add and/or git commit -a)git add readme warning: LF will be replaced by CRLF in readme. The file will have its original line endings in your working directorygit commit -m detach modify file [detached HEAD 69cde78] detach modify file1 file changed, 1 insertion()git log commit 69cde788edb4184538f2155ea5e062f5649e8781 (HEAD) Author: xxx xxx163.com Date: Thu Nov 9 15:56:42 2023 0800detach modify filecommit db2d096bf27e4e8f4ca42e8b185e973b05e186df Author: xxx xxx163.com Date: Thu Nov 9 10:21:31 2023 0800add readme2当再切回到master分支时git提示有一个commit未被连接到任意branch分支上可通过git branch来创建新分支。 git checkout master Warning: you are leaving 1 commit behind, not connected to any of your branches:69cde78 detach modify fileIf you want to keep it by creating a new branch, this may be a good time to do so with:git branch new-branch-name 69cde78Switched to branch master3在未把分离头指针对应的commit创建新branch时git log中是看不到它的信息的。 git log --all --graph # gitk --all 可调出图形界面 * commit e5d60c7d913d427b2e2161f717dff97249dd1f9b (temp) | Author: xxx xxx163.com | Date: Thu Nov 9 10:22:51 2023 0800 | | add temp_test | * commit 01df9fd5e046f104312468746168b027f4285c5c (HEAD - master) | Author: xxx xxx163.com | Date: Thu Nov 9 10:22:04 2023 0800 | | add file1 | * commit db2d096bf27e4e8f4ca42e8b185e973b05e186dfAuthor: xxx xxx163.comDate: Thu Nov 9 10:21:31 2023 0800add readme 4为detach区域建立分支。 git branch detach_branch 69cde78 # 复制前面git提示的命令语句添加分支名称即可git log --all --graph # 此时版本历史中就能看到detach分支的信息 * commit 69cde788edb4184538f2155ea5e062f5649e8781 (detach_branch) | Author: xxx xxx163.com | Date: Thu Nov 9 15:56:42 2023 0800 | | detach modify file | | * commit e5d60c7d913d427b2e2161f717dff97249dd1f9b (temp) | | Author: xxx xxx163.com | | Date: Thu Nov 9 10:22:51 2023 0800 | | | | add temp_test | | | * commit 01df9fd5e046f104312468746168b027f4285c5c (HEAD - master) |/ Author: xxx xxx163.com | Date: Thu Nov 9 10:22:04 2023 0800 | | add file1 | * commit db2d096bf27e4e8f4ca42e8b185e973b05e186dfAuthor: xxx xxx163.comDate: Thu Nov 9 10:21:31 2023 0800add readme5图形化界面看版本历史 gitk --all 三、比较commit内容 可通过git diff命令来比较两个commit之间的内容差异。 git log --all --oneline 69cde78 (detach_branch) detach modify file e5d60c7 (temp) add temp_test 01df9fd (HEAD - master) add file1 db2d096 add readmegit diff 69cde78 e5d60c7 # 后跟两个commit哈希值 diff --git a/file1 b/file1 new file mode 100644 index 0000000..e69de29 diff --git a/readme b/readme index 9fa5398..e69de29 100644 --- a/readmeb/readme-1 0,0 -test detach diff --git a/temp_test b/temp_test new file mode 100644 index 0000000..e69de29git diff后面也可以跟HEAD这样的指针名称以及用^和~1来表示父类 git diff HEAD HEAD^ # HEAD^ 表示HEAD指针对应commit的父commit diff --git a/file1 b/file1 deleted file mode 100644 index e69de29..0000000git diff HEAD HEAD^^ # HEAD^^ 父亲的父亲 fatal: ambiguous argument HEAD^^: unknown revision or path not in the working tree. Use -- to separate paths from revisions, like this: git command [revision...] -- [file...]git diff HEAD HEAD~1 # HEAD~1 HEAD^ diff --git a/file1 b/file1 deleted file mode 100644 index e69de29..0000000git diff HEAD HEAD~2 # HEAD~2 HEAD^^ fatal: ambiguous argument HEAD~2: unknown revision or path not in the working tree. Use -- to separate paths from revisions, like this: git command [revision...] -- [file...] 四、总结 一般情况下我们切换分支只在已有的几个分支名称之间来回切换但遇到切换到某个commit的情况时即出现分离头指针问题时要懂得该问题是如何产生的并通过什么样的操作步骤可以去解决它而不影响到现有分支。此外分离头指针现象也可以便于我们进行相关的测试在不影响现有生产的前提下。
http://www.w-s-a.com/news/665149/

相关文章:

  • 上海金瑞建设集团网站怎么创建免费网页
  • 柳州做网站设计的公司制作网站软件下载
  • 湖南seo网站开发苏州网络营销及网站推广
  • 如何发布自己做的网站郑州网站建设定制开发
  • 重庆网站商城宁波网络公司联系方式
  • 个人网站建设实验心得seo课程简介
  • 免费自助建站系统下载推广app网站
  • 用scala做的网站标题关键词优化技巧
  • 百度网站评级wordpress忘记admin
  • 建筑标准下载网站263企业邮箱 登陆
  • 旅游房地产网站建设德保网站建设
  • 网站高端建设wordpress订单系统
  • 建设网站成本增加网站备案
  • 行业网站建设方案百度云图片转wordpress
  • 如何建设网站推广平台营销客户管理软件
  • 网站制作南宁如何撰写一个网站规划建设方案
  • 建站网站和维护需要会什么杭州人防质监站网址
  • 唐山免费做网站莱芜吧贴吧最新消息
  • 韶关市建设工程造价网站网络营销的平台有哪些
  • 网站建设费大概多少钱成都网站建设低价
  • 做表格的网站东莞常平房价
  • 国家级建设网站高密做网站哪家强价位
  • 江西省新的建设厅三类人员网站做标记网站
  • 做最精彩绳艺网站产品设计培训
  • 营销型网站建设品牌深圳网络推广最新招聘
  • 单位网站等级保护必须做吗广州app软件开发公司
  • 免费flash网站模板怎么仿网站链接
  • 泉州网站建设哪家好平面设计转行做什么比较好
  • 忘记网站备案账号设计一个网站
  • 国内购物网站哪个最好海珠营销网站建设报价