I returned to a certain version under IDEA, and later found that the status was detached, which was actually checkout
caused by using commands.
git checkout
Essentially, the content in HEAD is modified to point to different branches, and the branch pointed by the HEAD file is our current branch. However, sometimes HEAD does not point to any branch. Strictly speaking, HEAD points to a branch without a branch name. Congratulations on the revised version, it is already in a detached state (detached HEAD). At this time, we commit
will not submit it to any branch during the operation.
At this time, it is impossible to push to the remote master branch.
Solution:
Create a branch so that the current version has a branch
git checkout -b temp
Then delete the original master branch master
git branch -D master
Rename the newly created branch to master
git branch -m tempn master
Finally, the commit is forced to the remote branch. The records after the original version of the returned branch are gone, and only the new commit is now available.
git push origin master --force