63
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

Organization

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

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

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

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
Sign upLogin
63
Help us understand the problem. What are the problem?