Git: How to commit untracked content?

后端 未结 1 1473
暗喜
暗喜 2021-01-28 10:53

Synopsis: git status gives

Changes not staged for commit:
(use \"git add ...\" to update what will be committed)
(use \"git checkout -- ...\" to

1条回答
  •  后悔当初
    2021-01-28 11:06

    A common reason for the problem:

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

    There are two possible solutions:

    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) 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.

    0 讨论(0)
提交回复
热议问题