如何修复“修改的内容,未跟踪的内容"?在git中? [英] How to fix "modified content, untracked content" in git?

查看:745
本文介绍了如何修复“修改的内容,未跟踪的内容"?在git中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标是提交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)

目录结构如下:

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

我在这里阅读了一个类似问题的答案:

I read an answer of to a similar question here:

如何跟踪未跟踪的内容?

,无法完全理解. 而且logc4plus/.gitmodules包含以下内容:

and couldn't understand it completely. Also the logc4plus/.gitmodules contains this:

[submodule "threadpool"]

        path = threadpool
        url = https://github.com/log4cplus/ThreadPool.git

[submodule "catch"]

        path = catch
        url = https://github.com/philsquared/Catch.git

推荐答案

我要做的是运行:

git rm -rf --cached myuntrackedfolder

这告诉git忘记它(因为它已被正式跟踪).

This tells git to forget about it (since it was being tracked formally).

然后我使用了:

git add myuntrackedfolder 

添加它,我很好.

这篇关于如何修复“修改的内容,未跟踪的内容"?在git中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆