@@ -3,6 +3,7 @@ package cmd
33import (
44 "bytes"
55 "context"
6+ _ "embed"
67 "errors"
78 "fmt"
89 "io"
@@ -305,11 +306,20 @@ func createDotCrushDir(dir string) error {
305306 }
306307
307308 gitIgnorePath := filepath.Join(dir, ".gitignore")
308− if _, err := os.Stat(gitIgnorePath); os.IsNotExist(err) {
309− if err := os.WriteFile(gitIgnorePath, []byte("*\n"), 0o644); err != nil {
309+ content, err := os.ReadFile(gitIgnorePath)
310+
311+ // create or update if old version
312+ if os.IsNotExist(err) || string(content) == oldGitIgnore {
313+ if err := os.WriteFile(gitIgnorePath, []byte(defaultGitIgnore), 0o644); err != nil {
310314 return fmt.Errorf("failed to create .gitignore file: %q %w", gitIgnorePath, err)
311315 }
312316 }
313317
314318 return nil
315319}
320+
321+//go:embed gitignore/old
322+var oldGitIgnore string
323+
324+//go:embed gitignore/default
325+var defaultGitIgnore string