Skip to content
/ rust Public
forked from rust-lang/rust

Commit 5c95a5c

Browse files
authored
Explain how to deal with exploded git submodules (rust-lang#2152)
1 parent 3d042d4 commit 5c95a5c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/git.md

+21
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,27 @@ $ git submodule foreach git reset --hard
597597

598598
and then try `git submodule update` again.
599599

600+
Unfortunately sometimes your local git submodules configuration can become
601+
completely messed up for some reason.
602+
603+
### Overcoming `fatal: not a git repository: <submodule>/../../.git/modules/<submodule>`
604+
605+
Sometimes, for some forsaken reason, you might run into
606+
607+
```text
608+
fatal: not a git repository: src/gcc/../../.git/modules/src/gcc
609+
```
610+
611+
In this situation, for the given submodule path, i.e. `<submodule_path> =
612+
src/gcc` in this example, you need to:
613+
614+
1. `rm -rf <submodule_path>/.git`
615+
2. `rm -rf .git/modules/<submodule_path>/config`
616+
3. `rm -rf .gitconfig.lock` if somehow the `.gitconfig` lock is orphaned.
617+
618+
Then do something like `./x fmt` to have bootstrap manage the submodule
619+
checkouts for you.
620+
600621
## Ignoring commits during `git blame`
601622

602623
Some commits contain large reformatting changes that don't otherwise change functionality. They can

0 commit comments

Comments
 (0)