Checking out an old commit and maintaining the head on the master branch?

后端 未结 6 1727
名媛妹妹
名媛妹妹 2020-12-22 16:29

Currently for switching to another git commit (on the same branch...actually, on the master branch!), I\'m executing the command

git checkout ea3d5ed039edd6d         


        
6条回答
  •  悲&欢浪女
    2020-12-22 17:23

    The question is a bit vague, but if you want to just change files in your working tree, you can simply do this:

    git checkout [commit|branch] -- .

    You can then stage the changes and create a new commit if you wish. This is pretty useful sometimes.

提交回复
热议问题