git-submodules

Git submodules : must a file located in a submodule's folder be tracked by that same submodule?

不想你离开。 提交于 2020-01-30 11:28:07
问题 I have git repo A containing submodule B. A file file.c is located inside B's folder, itself inside of A's folder as you'd expect. Question : can I track this file from A and not from B ? Does that even make any sense ? Idea is that any user of B has to add their own file.c in this specific location of B's folder hierarchy. If someone fails to do that but still adds B as submodule, B will simply mention that there is no target file upon compiling/running. 回答1: I have git repo A containing

How to do git sub modules and why to use git sub module

狂风中的少年 提交于 2020-01-24 03:12:27
问题 I have found an github project and it uses git submodules. What is the usage of git sub modules ? How to create git sub modules ? How they differ it from sub-tree ? Thanks 回答1: Git Submodule: A submodule in a git repository is like a sub-directory which is really a separate git repository in its own right. This is a useful feature when you have a project in git which depends on a particular versions of other projects Git Subtree: Git subtree allows you to insert any repository as a sub

How to setup submodule so that git clone --recursive always takes master of submodule

两盒软妹~` 提交于 2020-01-23 12:38:40
问题 I've reference this: Git submodule head 'reference is not a tree' error And this: git submodule tracking latest Possibly my problem is slightly different. (I'm assuming its the same but not doing something right...) I want my git setup such that if I run: git clone -b master --recursive /path/to/main/repo.git the submodules should always be cloned against "master" Otherwise, in many cases the referenced commit doesn't exist (The branch of the submodule) or are "out of date" causing the clone

Can I make a “deep copy” of a git repository with submodules?

爱⌒轻易说出口 提交于 2020-01-23 03:07:29
问题 It is easy to clone an entire project plus all its submodules: git clone --recursive git@github.com:homer/powerplant.git However, how do I create a clone that has all these submodules replaced by the HEADs of the individual sub-repositories themselves? Preferably in such a way that this can be repeated easy, as soon as something changes. The target should be a read-only "flat" version of the same overall code. No merging should be necessary. If this is possible, it would solve my Launchpad

Workflow for using git submodules in Visual Studio

拜拜、爱过 提交于 2020-01-22 07:15:06
问题 I have some shared code I want to share among a number of solutions. Most examples use the command line, but I want to do it using Visual Studio 2013 (and/or TortoiseGit)? - SolutionShared - .git - Project1Shared - Project2Shared - Solution1 - .git - ProjectFoo - ProjectBar - [SolutionShared] - [Project1Shared] - [Project2Shared] - Solution2 - .git - ProjectBaz - ProjectQux - [SolutionShared] - [Project1Shared] - [Project2Shared] What I did was to create a new solution SolutionShared , add

Git hook for updating Git submodule on branch change

故事扮演 提交于 2020-01-20 08:29:06
问题 I'm working with some old code that makes use of Git submodules. The code has several divergent branches which are actively being used, and each of these branches depends on unfortunately a different revision of the relevant submodules; this has made development extremely complicated. One of the problems I face is that, when I switch between branches from e.g. master to newfeature-foo using git checkout newfeature-foo , the state of the submodules remains at that of master , which often

How to change a git submodule to point to a subfolder?

拟墨画扇 提交于 2020-01-19 04:42:27
问题 Skimming through the SubModule tutorial, I created a submodule out of the boto project. Then, I discovered that I actually need only a subset of this project - specifically, the boto folder. I would like to change my submodule to point to this folder. When I look in .gitmodules, I see [submodule "backup/src/boto"] path = backup/src/boto url = https://github.com/boto/boto.git What URL should I use instead of https://github.com/boto/boto.git? After I change the URL, should I delete the boto

Git: Find out which branch contains a commit and check it out?

匆匆过客 提交于 2020-01-17 12:36:14
问题 From what I've learned here about submodules, I can now roll my submodules back to the right commit by using git submodule update --recursive however, now the submodules are never (rarely?) in a branch. I think that which branch the submodule needs is not stored. Anyway, I can use git branch --contains HEAD in the submodule and figure out the branch and then switch to it. Is there a built-in way to this? My goal is to get back to a branch that contains the commit (if there is one). 回答1: By

Checkout git submodule in Azure Pipeline with SSH

不羁的心 提交于 2020-01-16 12:35:08
问题 I try to checkout the git submodules via ssh instead of https (default if you use "Checkout submodules") in an Azure DevOps Pipeline. With the option in the picture it works - but for the developers it's annoying to enter the password all the time if they are working with the repository. For that I used the following instructions to add the ssh key. I created a public and a private key, and copied the known_host entry. That's my YAML file snippet: stages: - stage: DeployBackend jobs: - job:

Checkout git submodule in Azure Pipeline with SSH

二次信任 提交于 2020-01-16 12:34:21
问题 I try to checkout the git submodules via ssh instead of https (default if you use "Checkout submodules") in an Azure DevOps Pipeline. With the option in the picture it works - but for the developers it's annoying to enter the password all the time if they are working with the repository. For that I used the following instructions to add the ssh key. I created a public and a private key, and copied the known_host entry. That's my YAML file snippet: stages: - stage: DeployBackend jobs: - job: