86
63

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

git submodulesで間違えて追加したときの削除手順

Posted at

先日間違えてgit submodule add してしまったのでコミットする前に全部削除して再度git submodule add しようとしたら

console
A git directory for 'git-tools/git' is found locally with remote(s):            
  origin        https://github.com/git/git.git                                  
If you want to reuse this local git directory instead of cloning again from     
  https://github.com/git/git.git                                                
use the '--force' option. If the local git directory is not the correct repo    
or you are unsure what this means choose another name with the '--name' option.  

と言われ,はまったのでメモ

手順

  1. .gitmodulesから対象のモジュール情報を削除する
  2. .git/configのモジュール情報を削除する
  3. とってきたリポジトリを削除する
  4. .git/modules/以下にあるsubmoduleでとってきたリポジトリを削除する

以上です.
以後はまりませんように

86
63
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
86
63

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?