我可以签出最新的git提交吗?

时间:2018-11-08 07:50:41

标签: git

我有一个git别名lg = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all

当我运行$ git lg时,我可以看到以下内容。

*   0c86f9e - (3weeks ago) WIP on master: 3c98495 Delete old depart info and blog section - me(refs/stash)
|\
| * 1790d55 - (3weeks ago) index on master: 3c98495 Delete old depart info and blog section - me
|/
* 3c98495 - (5weeks ago) Delete old depart info and blog section - me (HEAD -> master)
* ffa196a - (5weeks ago) Delete client list section - me
* 4934070 - (5weeks ago) Delete portfolio section - me
* f73d676 - (5weeks ago) Show custom categories about departments - me
| * a9a174a - (5weeks ago) tmp save - me (feature/tmp)
|/
* 1f420bc - (7weeks ago) blabla... - me (origin/master, origin/HEAD)
.
.
.

但是0c86f9e之后我有更多的提交日志。也许像下面

*   0111113 - (3days ago) blahblah - me (HEAD)
*   0111111 - (3days ago) blahblah - me
*   0222222 - (3days ago) blahblah - me
*   0c86f9e - (3weeks ago) WIP on master: 3c98495 Delete old depart info and blog section - me(refs/stash)
|\
| * 1790d55 - (3weeks ago) index on master: 3c98495 Delete old depart info and blog section - me
|/

我想进行最新的提交。但是我找不到日志。如何查看日志并跳转?

2 个答案:

答案 0 :(得分:2)

获取它的长途之路是

git rev-list --all --reflog --date-order -1

git log(自然)也采用--reflog选项。

答案 1 :(得分:0)

假设您引用的最新提交在服务器上,则需要提取。 运行git pull,或者如果您不想更新当前的本地版本,请运行git fetch。 提交应该是可见的。