Help us understand the problem. What is going on with this article?

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

More than 5 years have passed since last update.

先日間違えて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でとってきたリポジトリを削除する

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

mercari
フリマアプリ「メルカリ」を、グローバルで開発しています。
https://tech.mercari.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした