Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the status of my git submodule, and how can I clean it up?

Being a relative submodules noob, I wanted to update my submodule with from its origin, and did:

git pull

This resulted in:

remote: Counting objects: 111, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 57 (delta 54), reused 57 (delta 54)
Unpacking objects: 100% (57/57), done.
From github.com:eteanga/smarty
   8e9a011..818ab3e  master     -> origin/master
You are not currently on a branch, so I cannot use any
'branch.<branchname>.merge' in your configuration file.
Please specify which remote branch you want to use on the command
line and try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.

Trying to fix:

git pull origin master

Output:

From github.com:eteanga/smarty
 * branch            master     -> FETCH_HEAD
Updating 8e9a011..818ab3e
Fast-forward
[snip]

Now it seems that I did get the updated code, but I'm not currently working on any branch.

What should I have done to update my submodule correctly, and what should I do to fix this current state?

like image 728
eoinoc Avatar asked Mar 26 '12 16:03

eoinoc


1 Answers

After a git submodule update, the HEAD in the submodule is set to the submodule commit-hash saved in the super project. If you want to reset the HEAD in the submodule to track the new commits in origin/master you first have to checkout to master and then to pull the changes:

In the submodule directory:

git checkout master
git pull origin master
like image 155
ouah Avatar answered Nov 17 '22 05:11

ouah