我使用 git checkout "commit number1"
回滚到先前的提交。然后我没有意识到我不在任何分支上,所以我在此处进行了更改并将代码提交到 "commit number1"
。
现在我切换到特性分支 feature/branch1
,但是我看不到任何代码。
如果我切换回 "commit Number1"
,我也看不到那里的代码。
我是否与任何内容分离?
$ git checkout 49da8b4d431
Note: checking out '49da8b4d431'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
我该如何恢复代码?我的代码去哪了?