I never expect renaming a git repo, which, more specifically, is the top-level folder holds the project, would be so hard. Yes, the project containing some submodules, but it is the top-level folder that needs renaming, not the submodule folder. Git, it seems, records some odd absolute paths in its submodule mechanisms.
Let's assume that
- All your projects locate in /tmp.
- You've got a proj_masterandproj_mod.
- You clone porj_masterasproj_ALLthen cloneprom_modas a submodule in it.
- You rename proj_ALLtoproj_onebillion. Then black magic happens.
The following steps will reproduce the problem I mentioned. The version of git I use is:
$ git --version
git version 1.7.9.5
- Initialize - proj_master.- $ cd /tmp $ mkdir proj_master; cd proj_master $ git init . $ touch README $ git add .; git commit -m "hello proj_master"
- Initialize - proj_mod.- $ cd /tmp $ mkdir proj_mod; cd proj_mod $ git init . $ touch README $ git add .; git commit -m "hello proj_mod"
- Clone - proj_masteras- proj_ALLand clone- proj_modas a submodule.- $ cd /tmp $ git clone proj_master proj_ALL $ cd proj_ALL $ git submodule add /tmp/proj_mod ./mod $ git add .; git commit -m "hello proj_ALL" $ git status % Everything is OK.
- Rename - proj_ALLto- proj_onebillion. Encounter a fatal error.- $ cd /tmp $ mv proj_ALL proj_onebillion $ cd proj_onebillion $ git status fatal: Not a git repository: /tmp/proj_ALL/.git/modules/mod
One thing to notice is the .git file in the submodule directory.
$ cat /tmp/proj_ALL/mod/.git 
gitdir: /tmp/proj_ALL/.git/modules/mod
Yeah, an absolute path. For the first time, I realize that git is aware of something outside the scope of the top-level repo folder.
That's it. I repeat that one more time that I rename the top-level project folder, not the submodule folder. I check schmuck's question, which tried to rename the submodule folder, therefore seems not so helpful to my problem.
If I miss something that should have been read before, I apologize. To all guys, any advice is welcomed.
 
     
     
     
     
     
    