Skip to content

Error when removing submodule #168

@lencioni

Description

@lencioni

I just ran into an interesting error when trying to make a commit that only removes a submodule. Here's what I did:

git submodule deinit path/to/submodule
git rm path/to/submodule
rm -rf .git/modules/path/to/submodule
git commit

The first time I tried committing, it ran the hooks but there were errors. The second time I tried committing, I get the following output:

Unable to setup environment for pre-commit hook run:
STDOUT:
STDERR:error: path/to/submodule: is a directory - add files inside instead
fatal: Unable to process path path/to/submodule
Cannot save the current worktree state

If I run git status everything looks as I would expect.

Doing this makes things work again:

git reset
git add .gitmodules
git rm path/to/submodule

I'm not really sure if this is a problem with overcommit or with git, but I figured I would start here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions