如何忽略我没有写入权限的模块中的更改?
How to ignore changes in modules for which I don't have write privileges?
我们有一个项目使用多个 git 模块。遇到了一些问题,我对我的本地副本做了一些修改。我没有模块的提交权限,所以更改将一直保留,直到它们被传播(通过其他方式)到正式版本,之后一切都会同步。
到那时,在 git
、.gitignore
或 .git/info/exclude
中是否有办法忽略这些更改的结果?我不知道怎么称呼它们,但在 GitHub 中它们看起来像这样:
[] packages/local/Foobar -Subproject commit-[lots of digits]
+Subproject commit-[lots of digits]-dirty
如果我有很多更改的文件,很容易忽略这些以取消选中它们,最终我会收到 git/GitHub 个错误。
在git status --help
中,有一个忽略子模块的命令行标志:
--ignore-submodules[=<when>]
Ignore changes to submodules when looking for changes. <when> can be either "untracked",
"dirty" or "all", which is the default. When "untracked" is used submodules are
not considered dirty when they only contain untracked content (but they are still scanned
for modified content). Using "dirty" ignores all changes to the work tree of submodules,
only changes to the commits stored in the superproject are shown (this was the behavior
before 1.7.0). Using "all" hides all changes to submodules (and suppresses the output of
submodule summaries when the config option status.submodulesummary is set).
如果您想永久忽略脏更改,请将忽略字段添加到 .gitmodules
中的子模块配置到 脏,如下所示:
[submodule "foo/bar"]
path = foo/bar
url = git://github.com/foo/bar.git
ignore = dirty
如果您想忽略所有更改,请添加 all 而不是 dirty:
[submodule "foo/bar"]
path = foo/bar
url = git://github.com/foo/bar.git
ignore = all
我们有一个项目使用多个 git 模块。遇到了一些问题,我对我的本地副本做了一些修改。我没有模块的提交权限,所以更改将一直保留,直到它们被传播(通过其他方式)到正式版本,之后一切都会同步。
到那时,在 git
、.gitignore
或 .git/info/exclude
中是否有办法忽略这些更改的结果?我不知道怎么称呼它们,但在 GitHub 中它们看起来像这样:
[] packages/local/Foobar -Subproject commit-[lots of digits]
+Subproject commit-[lots of digits]-dirty
如果我有很多更改的文件,很容易忽略这些以取消选中它们,最终我会收到 git/GitHub 个错误。
在git status --help
中,有一个忽略子模块的命令行标志:
--ignore-submodules[=<when>]
Ignore changes to submodules when looking for changes. <when> can be either "untracked",
"dirty" or "all", which is the default. When "untracked" is used submodules are
not considered dirty when they only contain untracked content (but they are still scanned
for modified content). Using "dirty" ignores all changes to the work tree of submodules,
only changes to the commits stored in the superproject are shown (this was the behavior
before 1.7.0). Using "all" hides all changes to submodules (and suppresses the output of
submodule summaries when the config option status.submodulesummary is set).
如果您想永久忽略脏更改,请将忽略字段添加到 .gitmodules
中的子模块配置到 脏,如下所示:
[submodule "foo/bar"]
path = foo/bar
url = git://github.com/foo/bar.git
ignore = dirty
如果您想忽略所有更改,请添加 all 而不是 dirty:
[submodule "foo/bar"]
path = foo/bar
url = git://github.com/foo/bar.git
ignore = all