LoginSignup
3
2

More than 3 years have passed since last update.

git clean で管理外のGitサブディレクトリを消す

Last updated at Posted at 2019-12-19

git clean -fd で消えない子達を消す方法。

Gitリポジトリの中に別のリポジトリを持ってきていると、git clean -fd では以下のようになって全ては消せない。

$ git clean -fd
Skipping repository sub-repo/

ありそうな状況としては、submoduleの検討段階とか?

Conclusion

git clean -ffd で全消しできる。

git clean help を読む

git clean -f の説明によると、-fだけだと.gitのあるディレクトリは消さないのでf2つ付けろと書いてある。

-f, --force
    If the Git configuration variable clean.requireForce is not set to false, git clean will refuse to delete files or
    directories unless given -f, -n or -i. Git will refuse to delete directories with .git sub directory or file unless a
    second -f is given.

参考

3
2
0

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
3
2