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 forgit checkout @{-1}.
@{-1} is the branchA of the last checkout: ... line@{-2} is the branchA of the previous to last checkout: ... lineIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With