How do I fetch/re-push a submodule in git?

2019-02-20 08:29发布

In my git repository (Bitbucket) I have a reference to a sub project.

When I pushed it on the first place a .git/ folder was included (even though I use the repository only for backup so that'd not been really needed).

Now I have a reference to that submodule in the repository

 <folder_name> → <SHA> [<SHA>])
  • When I do git pull origin master the folder if fetched but it's empty.
  • When I try to put stuff in that folder (I removed it, then I pulled it from a different repository and then removed the .git/ folder to make it looks a normal folder, not a submodule) and then git add . && git commit -m ".." && git push origin master I only get Everything's up-to-date and of course nothing changed in the remote repository

Goal: push a past submodule as a normal folder part of the main repository.

What I missing out? How do submodules work? (the docs @ Github are not very clear to me)

标签: git bitbucket
1条回答
\"骚年 ilove
2楼-- · 2019-02-20 09:15

As I explained this morning in "How to solve this Git issue?", this (ie '<folder_name> → <SHA> [<SHA>]') is not a submodule.

A submodule is composed of:

If you record only the SHA1, but not the url, you will have something like:

http://i.stack.imgur.com/d8JYH.png

A git clone --recursive won't be able to clone the repo with that SHA1, because it does not know its url.

If you want to reference a subproject as a submodule:

查看更多
登录 后发表回答