DoubleLi

qq: 517712484 wx: ldbgliet

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  4737 随笔 :: 2 文章 :: 542 评论 :: 1615万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

Task:知道commit号,如何checkout 指定版本

1. 切换到master: git checkout master

2. 下载最新代码:  git pull

3. 下载head: git checkout HEAD

4. 查看log找到需要的版本: git log

5. 根据header checkout : git checkout XXXXXX

复制代码
复制代码
 1 [root@hpc66-80 ebs]$ git branch
 2 * consistencyCheck
 3   master
 4 [root@hpc66-80 ebs]# git checkout master
 5 Switched to branch 'master'
 6 [root@hpc66-80 ebs]# git branch
 7   consistencyCheck
 8 * master
 9 [root@hpc66-80 ebs]# git checkout HEAD
10 [root@hpc66-80 ebs]# git log |more
11 commit e24385f84866f0010d3317164b23be9e6054f283
12 Merge: 31d7dc5 41ac93d
13 Author: wa357 <wa6@dd.com>
14 Date:   Wed Apr 26 13:08:11 2017 +0800
15 
16     merge modify_election
17 
18 commit 41ac93d383abf2e3b83a2df1cd3c201877867d2d
19 Author: lij <lij@dd.com>
20 Date:   Mon Apr 24 16:00:15 2017 +0800
21 
22       modify the position of calling
23 
24 commit 40b81hpc6685c7340106206fa171d0611767d40f93b
25 [root@hpc66-80 ebs]# git checkout e24385f84866f0010d3317164b23be9e6054f283
26 Note: checking out 'e24385f84866f0010d3317164b23be9e6054f283'.
27 
28 You are in 'detached HEAD' state. You can look around, make experimental
29 changes and commit them, and you can discard any commits you make in this
30 state without impacting any branches by performing another checkout.
31 
32 If you want to create a new branch to retain commits you create, you may
33 do so (now or later) by using -b with the checkout command again. Example:
34 
35   git checkout -b new_branch_name
36 
37 HEAD is now at e24385f... merge modify_election_datanode_algorithm
38 [root@hpc66-80 ebs]#
39 [root@hpc66-80 ebs]# git branch
40 * (detached from e24385f)
41   consistencyCheck
42   master
复制代码
复制代码

 check out 指定的branch

1 git clone git@git.com:XXXX.git
2 git branch
3 git branch -a //查看历史
4 git branch -d dev //删除本地分支
5 git checkout -b dev origin/dev //checkout 远程
6 git log //查看日志
posted on   DoubleLi  阅读(4042)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
历史上的今天:
2017-07-15 跨平台的EVENT事件 windows linux
2017-07-15 条件变量(Condition Variable)详解
2014-07-15 经典系统windows xp sp3官方原版下载(附XP序列号)
2013-07-15 pragma pack(非常有用的字节对齐用法说明)
点击右上角即可分享
微信分享提示