简体   繁体   中英

Nested Repository. Git. Change working directory

What I have I have a Git Repository inside another. Like

Repo1/
     .git
      fileOfRepo1
      Repo2/
          .git
           fileofRepo2

I have done some commit in repo1 and repo2.

HERE is the problem When doing checkout to a previous commit of repo1 I would like to have my files change to those of the previous commit. That happens for the files of the Repo1 it doesnt for those of Repo2.

It DOES however recognize that something happened here is how I know that

If I am in the last commit of Repo1 on branch master I obtain

$ git status
On branch master
nothing to commit, working directory clean

However after I do

$git checkout SHA

I obtain

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)

        modified:   Repo2 (new commits)

no changes added to commit (use "git add" and/or "git commit -a")

If I were using submodules I will type : git submodule update and I will get the desired behaviur,but I DO NO want to use submodules. SERIOUSLY no submodules advice please. Can i be more clear NO SUBMODULES.

I am using a local repository is just to organize my own projects.

So it appears that git ignores sub folders which are git repos on their own. So it doesn't recurse down to the child repo, so that state won't change when you checkout a different version in the parent repo, resulting it in not getting the version of the child associated with the parent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM