English 中文(简体)
git submoule amended file status
原标题:git submodule modified files status

我在我的大树中添加了一个子树, t树改变了任何东西,但显示有改动。 我在这一点上做了些什么?

$ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#    modified:   example.com/soundmanager
#
no changes added to commit (use "git add" and/or "git commit -a")

I ve tried a git submodule update, but it doesn t do anything.

最佳回答

象牙齿类子类的地位报告方式在最近版本的 g类中发生了很大变化,因此,你应当真正包括<条码>(git)——转录<<>/代码”的产出,并且使我们能够准确地提供帮助。

但无论如何,<代码>git diff example.com/deptmanager的产出 应该告诉大家。 如果你以相同名称看到产出,但以<代码>-dirty 加入新版本,例如:

diff --git a/example.com/soundmanager b/example.com/soundmanager
--- a/example.com/soundmanager
+++ b/example.com/soundmanager
@@ -1 +1 @@
-Subproject commit c5c6bbaf616d64fbd873df7b7feecebb81b5aee7
+Subproject commit c5c6bbaf616d64fbd873df7b7feecebb81b5aee7-dirty

... than that means that git status in the submodule isn t clean - try cd example.com/soundmanager and then git status to see what s going on.

On the other hand, if you see different commit versions, e.g.:

diff --git a/example.com/soundmanager b/example.com/soundmanager
index c4478af..c79d9c8 160000
--- a/example.com/soundmanager
+++ b/example.com/soundmanager
@@ -1 +1 @@
-Subproject commit c4478af032e604bed605e82d04a248d75fa513f7
+Subproject commit c79d9c83c2864665ca3fd0b11e20a53716d0cbb0

... that means that the version that your submodule is at (i.e. what you see from cd example.com/soundmanager && git show HEAD) is different from the version committed in the main project s tree (i.e. what you see from git rev-parse HEAD:example.com/soundmanager). If the former is right, you should add and commit the new version of the submodule in your main project, with something like:

git add example.com/soundmanager
git commit -m "Update the soundmanager submodule"

另一方面,如果后者是你想要的,你就可以改变该分单元的版本:

git submodule update example.com/soundmanager
问题回答

我使用了以下指挥手段来解决这个问题:

git submodule update --init  --recursive

在这方面,我错误地增加了一个子模块,具体增加一个目录,而不是仅仅增加新目录的内容。

我只需要删除这样的分层:

git rm --cached path/to/my/new_directory

之后,首先加上我所想的内容:

git add path/to/my/new_directory/*




相关问题
git confusion - cloning a repo is returning a past version

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...

热门标签