"Submodule Add" should not detach HEAD
By robert.pol... on September 22, 2010 07:52 (imported from Google Code)
What steps will reproduce the problem?
- Add a new submodule.
- Look at its current branch.
What is the expected output?
It should be on "master".
What do you see instead?
It is on "no branch".
According to the git-submodule man page, the "update" command makes "the submodules HEAD be detached unless --rebase or --merge is specified".
This causes the problem described in http://book.git-scm.com/5_submodules.html :
"It's not safe to run git submodule update if you've made and committed changes within a submodule without checking out a branch first. They will be silently overwritten"
(The changes are still visible in the submodule's reflog.)
Maybe the "Submodule Add" should have a branch name as (optional) argument?
"[...] create a branch when you work in a submodule directory with git checkout -b work or something equivalent. When you do the submodule update a second time, it will still revert your work, but at least you have a pointer to get back to."
What version of the product are you using? On what operating system?
TortoiseGit-184.108.40.206-32bit.msi on Windows XP
Since this is a dataloss issue (at least for git beginners), I have set the priority to high.