git reflog 和git log的区别,外加git cherry-pick的一种用法

git reflog 可以查看所有分支的所有操作记录(包括(包括commit和reset的操作),包括已经被删除的commit记录,git log则不能察看已经删除了的commit记录

具体一个例子,假设有三个commit, git st:

commit3: add test3.c

commit2: add test2.c

commit1: add test1.c

如果执行git reset --hard HEAD~1则 删除了commit3,如果发现删除错误了,需要恢复commit3,这个时候就要使用git reflog

 HEAD@{0}: HEAD~1: updating HEAD
63ee781 HEAD@{1}: commit: test3:q
红色加粗的即是被删除了的 commit3,运行git log则没有这一行记录

可以使用git reset --hard 63ee781将红色记录删除,则恢复了cmmit3,运行git log后可以看到:

commit3: add test3.c

commit2: add test2.c

commit1: add test1.c

这里也可以使用另外一种方法来实现:git cherry-pick 63ee781

git reflog 和git log :no branch git 提交方式的更多相关文章

  1. Git 协作:Fetch Pull Push Branch Remote Rebase Cherry-pick相关

    前言 学习git的时候,我们首先学习的是最常用的,自己独立开发Software时用的命令: git init //初始化git仓库 git add <file_name> //将文件添加到 ...

  2. Git reflog 引用日志使用详解

    本章节主要介绍 git reflog 命令. Git 使用一种称为引用日志或"reflogs"的机制来跟踪分支顶端的更新. 许多 Git 命令接受用于指定引用或"ref& ...

  3. Git学习总结(5)——搭建Git简易高效服务器

    1. mysysgit+gitblit安装流程 1.1资源  需先下载好的资源(公司用的1.6,1.7+请自行匹配对应的mysysgit+gitblit):  jdk1.6  Git-1.8.4-pr ...

  4. Git相关二三事(git reflog 和彩色branch)【转】

    转自:https://www.jianshu.com/p/3622ed542c3b 背景 git太常用了,虽然,用起来不难,但也有很多小技巧的东西... 1. 后悔药 哪天不小心,写完代码,没comm ...

  5. Git log和git reflog

    1.git log  log命令可以显示所有提交过的版本信息.显示信息如下: $ git log commit e1bdff6e4830e09383078c860f45334d03771b03 (HE ...

  6. git log 与 git reflog 的 区别

    git log: commit 的版本日志 包含提交的版本 操作者 日期 (方便查看commit的版本,但是版本回退后,使用git log 看不到回退版本号之后的版本记录) commit ce0d69 ...

  7. 比 git log 更强大的 git reflog

    最近做了个骚操作 git checkout commitId 修改了部分内容 git add . git commit -m '修改了些东西'   -> 此时git 会自动生成一个新的 comm ...

  8. [译]git reflog

    用法 git reflog 显示整个本地仓储的commit, 包括所有branch的commit, 甚至包括已经撤销的commit, 只要HEAD发生了变化, 就会在reflog里面看得到. git ...

  9. git merge,rebase和*(no branch)

    上一篇:http://blog.csdn.net/xiaoputao0903/article/details/23933589,说了git的分支,相关的使用方法没说到可是仅仅要google就能搜出一大 ...

随机推荐

  1. JVMInternals--reference

    This article explains the internal architecture of the Java Virtual Machine (JVM). The following dia ...

  2. Validation

    Validation A simple but powerful Validation Engine, in a Laravel-esque style. Its Validation Rules a ...

  3. Bootstrap的Affix与ScrollSpy用法 bootstrap-scrollspy && bootstrap-dropdown

    bootstrap-scrollspy && bootstrap-dropdown Bootstrap的Affix与ScrollSpy用法 http://9iphp.com/web/j ...

  4. 例3-13设置ROI

    写在前面,写的时候总有种给别人写的感觉,然后就写得很冗长,也没有办法很好的表达自己的想法,总觉得写得越多越好,实则不然,要最言简意赅,还能表达意思. 嗯! 只写自己不明白的地方,如果恰巧有人也看了我的 ...

  5. C语言结构体的引入

    #include <stdio.h> struct student{ int ID; ]; int age; }; int main(){ //赋值: , }; ,.name=}; , , ...

  6. VS版本下载

    tfs2012:BVGTF-T7MVR-TP46H-9Q97G-XBXRB http://www.microsoft.com/zh-cn/download/details.aspx?id=30658 ...

  7. myeclipse使用太卡问题

    最近写html文件,修改内容时,就会反应好长时间,太卡. 原因:没修改一次,它就会自动校验. 解决方法:window——preferences——Editors——Text Editors ——spe ...

  8. [转]让你提升命令行效率的 Bash 快捷键

    生活在 Bash shell 中,熟记以下快捷键,将极大的提高你的命令行操作效率. 编辑命令 Ctrl + a :移到命令行首 Ctrl + e :移到命令行尾 Ctrl + f :按字符前移(右向) ...

  9. Xilinx 网站资源导读2

    Xilinx 网站资源导读 ———版权声明———–本文作者 Ricky Suwww.fpganotes.comrickysu.fpga@gmail.com 欢迎转载,转载请保持原样及署名商业使用须得到 ...

  10. Opencv——将摄像头拍摄写成视频文件

    这里主要利用了Opencv打开摄像头的代码,以及写入视频的函数,只是这里要注意的是摄像头好像没有帧率,在cvCreateVideoWriter,时要自己设置 #include"cv.h&qu ...