美文网首页
git进阶 之 reflog

git进阶 之 reflog

作者: 诺之林 | 来源:发表于2020-06-03 10:00 被阅读0次

示例

mkdir git-demo && cd git-demo

git init
echo 0 > test

git add .

git commit -am "init 0" 

echo "1" >> test

git commit -am "add 1"

git checkout -b feature
git log --oneline
# cb41bee (HEAD -> master) add 1
# f9ca73f init 0

cat .git/refs/heads/master
# cb41beed05d68b8792d09b7125caad50acc95c7a

cat .git/HEAD
# ref: refs/heads/feature

提交

  • git三大对象类型: 数据对象(Blob Object) / 树对象(Tree Object) / 提交对象(Commit Object)

git进阶 之 object

  • git is all about commits: you stage commits, create commits, view old commits, and transfer commits between repositories using many different Git commands

Atlassian Refs and the Reflog

  • git-log - Show commit logs

Git Documents git-log

引用

  • git三大常见引用: HEAD(指向当前分支) / Branch / Tag

git进阶 之 reference

  • A ref is an indirect way of referring to a commit. You can think of it as a user-friendly alias for a commit hash

Atlassian Refs and the Reflog

  • git-reflog - Record when the tips of branches and other references were updated in the local repository

Git Documents git-reflog

场景

git reset --hard HEAD^
# HEAD is now at f9ca73f init 0

git log --oneline
# f9ca73f (HEAD -> master) init 0

git reflog
# f9ca73f (HEAD -> master) HEAD@{0}: reset: moving to HEAD^
# cb41bee HEAD@{1}: commit: add 1
# f9ca73f (HEAD -> master) HEAD@{2}: commit (initial): init 0

git reset --hard HEAD@{1}
# HEAD is now at cb41bee add 1

git log --oneline
# cb41bee (HEAD -> master) add 1
# f9ca73f init 0

参考

相关文章

  • git进阶 之 reflog

    示例 提交 git三大对象类型: 数据对象(Blob Object) / 树对象(Tree Object) / 提...

  • git常用命令

    git log git reflog git reset git log git reflog git check...

  • iOS Git

    Git$ git reflog : Git提供了一个命令git reflog用来记录你的每一次命令:$ git r...

  • git教程

    git教程 git reflog git reflog 可以查看所有分支的所有操作记录(包括(包括commit和r...

  • git log和git reflog的区别

    git log和git reflog的区别 git reflog命令可以查看所有分支的所有操作记录信息(包括已经被...

  • git reflog

    前言 之前开发的时候遇到过一次电脑异常重启的状况,电脑重启后再次进入Android Studio, 发现代码不在原...

  • Git 更改已提交的操作

    git reflog 查看当前仓库的所有操作日志 reflog git log 命令只能查看以当前状态为终点的历史...

  • git 回到之前某次状态

    git reflog + 分支名git reset --hard 分支名@{3}

  • 常用命令

    git reflog | git log | git status [http://blog.csdn.net/f...

  • git commit历史里消失的记录怎么看

    或者自己本地如果对应的目录还在的话,可以用git reflog命令 利用git reflog找回错误的重置[htt...

网友评论

      本文标题:git进阶 之 reflog

      本文链接:https://www.haomeiwen.com/subject/yvkpzhtx.html