开发者

git checkout newer branch

开发者 https://www.devze.com 2023-02-28 15:27 出处:网络
I switched to a older commit with: git checkout $HASH to look f开发者_Python百科or something i did in an older version of my directory. Now i want to go back to the newest commit, but i cant find the

I switched to a older commit with: git checkout $HASH to look f开发者_Python百科or something i did in an older version of my directory. Now i want to go back to the newest commit, but i cant find the Hash for that anymore? when i do a git log it just shows the older commits from the commit i am currently at. How can i switch to the newest commit again?


git checkout <branch>, e.g. git checkout master.


Use the name of the branch on which you worked before

git checkout [branch]

If for some reason you don't know the name, you can find the previous position in the reflog

git reflog

It gives you a list of commits on which you worked in the past, where the first position is the most recent one.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号