git-submodules

How to see which commit a git submodule points at

孤者浪人 提交于 2020-08-21 05:48:46
问题 As far as I know, if you add a submodule in git then it points to a certain commit in that submodule. Is there any way to see which commit a submodule is pointing at without checking it out? 回答1: Sure... git ls-tree <commit>:<path to dir that has a submodule as a subdir> Example: git ls-tree HEAD:src/thirdparty Or just: git ls-tree -r HEAD to see everything. Submodules will show up as type commit (as opposed to the usual blob or tree ). 回答2: As the other answers explain, you can use two

Import React component from Git submodule repository

混江龙づ霸主 提交于 2020-08-09 07:11:47
问题 I have a parent repository developed with React, and I have a child Sub Module inside of it(which is developed by react too): The project folder structure is something like below: parent /.git /nodemodule /src /subModules/childProject /.git /src /js /x.jsx // i want this file from parent project /... /... I want to access and use the x.jsx component from parent project. I imported it like blow in my parent project: import X from '../subModules/childProject/src/js/x.jsx' but it gives me

Pycharm imports from Git Submodule

北慕城南 提交于 2020-08-05 05:04:52
问题 I have a python project in Pycharm, wherein there is a nested Git submodule. Here is the folder structure: my-git-repo git-submodule-repo package1 foo.py bar.py package2 baz.py .gitmodules The imports in git-submodule-repo are structured as follows: foo.py: from package1.bar import some_func However, Pycharm doesn't recognize this and wants me to instead have the following: foo.py: from git-submodule-repo.package1.bar import some_func This is problematic because I don't want to have to change

Is it possible to patch a submodule in Git from the parent project?

偶尔善良 提交于 2020-07-27 07:10:47
问题 I have a project main that contains a submodule foo . For this particular project, I would like to make a small change to foo that only applies to this particular project main . main/ + .git + main.c + lib/ | + bar.c + foo/ # My `foo` submodule + .git + config.h # The file I want to patch from `main` + ... A common solution would be to go down to my submodule, make a commit Applied patch for main on a new branch called main-project , then push it. Unfortunately, this is a very bad approach

A git submodule is stuck at wrong commit ('submodule update' doesn't work)

拈花ヽ惹草 提交于 2020-07-03 04:52:05
问题 I have a parent project with a submodule (no nested submodules). The submodule has a new commit (let's call it new-sha ), and the parent refers to that commit in remote repo (I can see submodule @ new-sha when viewing the repo in web browser). I have pulled the parent project, and it also refers to the right commit in the working directory, as seen in git show output: --- a/submodule --- b/submodule @@ -1 +1 @@ -Subproject commit old-sha +Subproject commit new-sha I.e. the latest commit in

Package Manager vs. Git Submodule/Subtree

一世执手 提交于 2020-06-24 06:22:31
问题 Are there any reasons to use a package manager rather than git submodules/subtrees, or vice versa? The git solutions seem to be a lot more hassle than a simple package manager. Assume that the space-saving benefit of git submodules is not important. Update: Someone added a C++ tag to this question, but I have removed it since. This question did not specifically pertain to C++. More general answers than the accepted answer are welcome. 回答1: The git solutions seem to be a lot more hassle than a