Why did my Git repo enter a detached HEAD state?

后端 未结 9 2633
渐次进展
渐次进展 2020-11-21 04:36

I ended up with a detached head today, the same problem as described in: git push says everything up-to-date even though I have local changes

As far as I know I didn

9条回答
  •  抹茶落季
    2020-11-21 05:16

    When you checkout to a commit git checkout or to a remote branch your HEAD will get detached and try to create a new commit on it.

    Commits that are not reachable by any branch or tag will be garbage collected and removed from the repository after 30 days.

    Another way to solve this is by creating a new branch for the newly created commit and checkout to it. git checkout -b

    This article illustrates how you can get to detached HEAD state.

提交回复
热议问题