![]() To save changes committed in a detached HEAD state, you first need to create a new branch.Ĭontinuing from the scenario described above, you create a new branch called temp-branch. To keep the changes made while in the detached HEAD state, use these three steps: It just means you are not currently attached to any branch, and as a result, your HEAD is detached. But what if you are in the detached HEAD state by mistake then perform commits over commits? If you are committing in the detached HEAD state, does that mean your changes are not saved? If you find yourself a detached HEAD state and realize it quickly, you can quickly recover by checking out the previous branch. For example, checking out to a specific tag name or adding ^0 on any given branch causes the detached HEAD state. Some other scenarios can cause a detached HEAD as well. If you check out to the origin (main) branch, which is read-only, you will be in the detached HEAD state. Another situation that causes a detached HEAD is checking out the remote branch. We already demonstrated that if you check out the SHA-1 commit hash, you will be in the detached HEAD state.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |