如何签出最新的提交(分支的提示)

How to checkout the newest commit (tip of a branch)

假设我在 Git 图的顶端并且我在 "latest" 提交上,我们称它为 commit-x。假设我用

签出一个较旧的 git 提交
git checkout <commit-old>

这样做之后,有没有办法再次检出最新的提交 (commit-x),而不必知道 commit-x 是什么?

换句话说,如何自动检查 Git 分支的提示?

git checkout branch-name 正是这样做的。

git checkout branch-name # if you remember it
git checkout -           # if not & was the last checkout (may not have been)
<CTRL-KR> checkout       # To search shell history of checkout commands for last non-hash branch name