本文介绍了Git:如何提交未跟踪的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简介:git status提供

Synopsis: git status gives

已修改:<文件夹名称> (已修改的内容,未跟踪的内容)

modified: < folder name > (modified content, untracked content)

万一:

  • 'git add'不会改变情况
  • 您正在寻找一种提交未跟踪内容的方法
  • 'git add' does not change the situation
  • You are looking for a way to commit the untracked content

解决此问题的正确方法是什么?

What is the right way to fix that?

这里有一个相关的问题:如何跟踪未跟踪的内容?,A常见问题的简单答案是隐藏在第二个未接受的答案中.希望该线程可以增加清晰度.

There is a related question here: How to track untracked content?, A simple answer to the common problem is hiding at the second, non accepted answer. Hope this thread would add clarity.

推荐答案

出现此问题的常见原因:

A common reason for the problem:

子文件夹中不相关的git仓库(".git"文件夹)阻止主git仓库跟踪子文件夹.

An unrelated git repository (".git" folder) in a subfolder, prevents the main git repository from tracking the subfolder.

有两种可能的解决方案:

There are two possible solutions:

1)简单修复:仅使用主存储库-删除问题" 子文件夹中的".git"文件夹.主存储库的.git文件夹(如果可能)在本地复制要删除的内容作为备份-以防万一
[@neoneye在这里如何跟踪未跟踪的内容?]

1) Simple fix: using only the main repository - delete the ".git" folder in the 'problematic' subfolder
Take care not to delete the .git folder of the main repository, if possible copy what you intend to delete locally as a backup - just in case
[This idea had been suggested by @neoneye here How to track untracked content? ]

2)使用子模块:使用git子模块可能是您想要的解决方案.要了解有关此选项的信息,您可以找到相关文章 https://medium.com /@ porteneuve/mastering-git-submodules-34c65e940407 非常有用.

2) Using sub-module:Using git sub-module might be the solution you want. To get informed about this option you might find the related article https://medium.com/@porteneuve/mastering-git-submodules-34c65e940407 very useful.

这篇关于Git:如何提交未跟踪的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 03:53
查看更多