'Clonning a repo inside another repo in git

I am trying to clone a repo inside another repo. In the inner repo, I want to make some changes according to my need. When i am trying to commit these changes, i am getting an issue:

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)
        modified:   infrastructure/accounts/customer/xyz (modified content)
   no changes added to commit (use "git add" and/or "git commit -a")

I want to use the inner repo as a fixed module only for my code. Please let me know how can i achieve this.



Solution 1:[1]

If you want to add, commit and pushed changes done from your inner repository, you need first to cd (change directory) to your inner repo root folder.

Then you can add/commit/push from that root folder.

Go back one level up, and you can record the new inner repo state (its root tree SHA as a gitlink entry).

Make sure you have added that repository as a submodule of your parent main project repository.

From that main project, a git diff --submodule=diff would show the differences from the inner repository.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1