简体   繁体   中英

Git submodules and orphaned commits

I have a git repo (A) where each commit is an orphaned commit with a name (branch). Git repo B consumes A as a submodule, and as such is always holding a reference to a SHA in A. When I make a fresh clone of BI need to do the typical git submodule init/update incantation, but I don't want it to clone all of A. I just want it to clone the single orphaned commit which is the submodule reference.

However, even when I try git submodule update --init --recursive --depth 1 path/to/A , git clones from master instead. Is there a way I can convince it to clone only the SHA that I care about?

If B consumes A as a submodule, it should do so by configuring A submodule to follow a branch .

That way, a git submodule update --init --recursive --remote --depth 1 path/to/A should checkout from the branch it is supposed to follow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM