Ayu*_*ush 11 git git-submodules
目标是提交一个git分支.分支的"git status"输出为:
On branch zeromq_new
Your branch is up to date with 'origin/zeromq'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: log4cplus (modified content, untracked content)
modified: ../lib/notification/cppzmq (modified content)
Run Code Online (Sandbox Code Playgroud)
目录结构如下所示:
HySecureGateway
???fes
? ???log4cplus
? ???.git
? ???.gitattributes
? ???.gitignore
? ???.gitmodules
? ???catch
? ? ???.git
? ? ???.gitattributes
? ? ???.github
? ? ???.gitignore
? ? ???.github
? ? ???issue_template.md
? ? ???pull_request_template.md
? ???threadpool
? ???.github
???lib
???notification
???cppzmq
???.git
???.gitignore
Run Code Online (Sandbox Code Playgroud)
我在这里读到了一个类似问题的答案:
并完全无法理解.logc4plus/.gitmodules还包含:
[submodule "threadpool"]
path = threadpool
url = https://github.com/log4cplus/ThreadPool.git
[submodule "catch"]
path = catch
url = https://github.com/philsquared/Catch.git
Run Code Online (Sandbox Code Playgroud)
xpl*_*er1 25
我做的是跑:
git rm -rf --cached myuntrackedfolder
Run Code Online (Sandbox Code Playgroud)
这告诉git忘记它(因为它正在被正式跟踪).
然后我用了:
git add myuntrackedfolder
Run Code Online (Sandbox Code Playgroud)
添加它,我很高兴去.
解决方案涉及从带有“已修改的内容,未跟踪的内容”标签的目录中删除.git /,从这些目录中删除--cached文件,然后git add再次在这些目录上运行。
分步解决方案:
git rm -rf --cached log4cplus/ && git rm -rf --cached ../lib/notifications/cppzmq快乐的编码。
出于某种原因,这些单独的存储库更改了文件。有几种方法可以处理它,具体取决于它们的实际情况。
您可以导航到每个存储库并查看更改了哪些文件。然后您可以提交、创建新分支或删除更改。
如果这些 repos 是您想要跟踪但不想弄乱的单独项目,您可以使您的父 repo 简单地忽略这些子模块中的更改:
git update-index --assume-unchanged $DIRECTORY
(其中 $DIRECTORY 是您要忽略更改的子模块)
| 归档时间: |
|
| 查看次数: |
16813 次 |
| 最近记录: |