How to preserve all ignored files in git clean -fd?

后端 未结 3 1933
小鲜肉
小鲜肉 2020-12-29 01:46

When I have .gitignore data/* and run git clean -fd, the data folder and all its content files are deleted.

What I want is to delete all un

3条回答
  •  忘掉有多难
    2020-12-29 02:34

    Git normally doesn't clean ignored files unless the -x flag is specified, but strangely it cleans out when configured as you did (folder/*).

    As @VonC pointed out, you should change your .gitignore-file to ignore the directory (data/) rather than its contents (data/*).

    It's a subtle difference, but it matters to git.

提交回复
热议问题