git - “混帐添加。”两个分支的 merge 命令后不工作

标签 git

我 merge 了两个分支。现在,当我尝试 git add . 时,命令会忽略一个文件夹。然后我运行'git status',它以红色显示-'modified:admin'。

$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working d
#   (commit or discard the untracked or modified content in submodul
#
#       modified:   admin (modified content)
#
no changes added to commit (use "git add" and/or "git commit -a")

如何将更改提交给管理员?

最佳答案

admin 不是文件

这条消息:

#       modified:   admin (modified content)

表示admin是一个子模块。

这是一个处于脏状态的子模块——其中有未提交的更改。从主存储库中没有要提交的更改,因为子模块的存储库没有更改,因此如果您尝试提交这种情况,则不会发生任何事情,但是您会收到一条警告,指出子模块包含“已修改的内容”。

如何提交更改

子模块需要更新,以便主存储库能够引用这些更改,即:

cd admin
git commit -va
# review and then commit the changes
git push # important if you want to be able to access this change elsewhere

cd ..
git add admin
git commit admin -m "bumping admin submodule"

如果子模块不是您自己的代码,这很可能不是您想要做的 - 在这种情况下,请解释(通过编辑问题)目标,即更改的目的一个依赖。

关于git - “混帐添加。”两个分支的 merge 命令后不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20122419/

相关文章:

git - rebase 依赖主题分支

git - MacOS:使用 Bitbucket 和 Github、SSH key ?

git - stash 在 git 中是如何工作的 - 内部

git - 为什么按名称删除远程分支会产生错误,而按引用删除则不会?

Git:如何将工作文件重置为其索引版本?

node.js - openshift nodeJS 应用程序 - git 最新/服务器运行没有错误,但我仍然看到欢迎页面

git - git push 是慢了还是出了什么问题?

git - 使用 Git,如何记录两个特定分支之间 merge 提交的所有提交?

git - 从 bash 更新 github 上的文件

git - 如何仅从 git 子模块克隆一个文件夹?