Created
November 10, 2020 16:13
-
-
Save andmax/2ef51dbb2475489564206c8560aeeb45 to your computer and use it in GitHub Desktop.
Teaches a simple fix when git HEAD is detached
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Sometimes a git submodule may lose its head during commit | |
2. It appears as: HEAD detached ... | |
3. This may be because the commit done as submodule creates | |
4. a "virtual" branch (hopefully will be fixed in the future) | |
5. One way to fix it is to do: | |
cd <submodule dir> | |
git add <changed files in submodule> | |
git commit -m <message> | |
git status # showing HEAD detached | |
git branch tmp | |
git checkout master | |
git merge tmp | |
git branch -d tmp | |
git push origin master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment