Where does git store the last checked out branch?
When I do git checkout - , git checks out the last branch I had checked out. Where is that information stored?
It scans .git/logs/HEAD (the reflog for HEAD ) for the last line looking like :
checkout: moving from <branchA> to <branchB>
the "last branch" is branchA
As said in the post linked by @SergioTulentsev :
git checkout - is a shorthand for git checkout @{-1} .
@{-1} is the branchA of the last checkout: ... line @{-2} is the branchA of the previous to last checkout: ... line 上一篇: 咖啡脚本不会在更换页面时触发,但适用于页面加载。 [Rails 5]
下一篇: git在哪里存储上次检出的分支?
