diff --git a/cmd/init.go b/cmd/init.go index f90195f..d280648 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -81,6 +81,23 @@ func runInitCommand(cmd *cobra.Command, args []string) { if err != nil { log.Fatal(err) } + + gitignoreContent := []byte (` + # ignore dotctl config for individual installations + dotctl/ + + .DS_Store + *.swp + *.bak + *.tmp + `) + + err := afero.WriteFile(fs, filepath.Join(DotfilePath, ".gitignore"), gitignoreContent, 0644) + + if err != nil { + log.Fatal(err) + } + } fmt.Fprintf(cmd.OutOrStdout(), "Successfully created dotfiles repository at %s\n", DotfilePath) diff --git a/cmd/sync.go b/cmd/sync.go index 148f5df..88ce593 100644 --- a/cmd/sync.go +++ b/cmd/sync.go @@ -53,6 +53,9 @@ func gitAddFiles(worktree *git.Worktree, fs afero.Fs) error { return err } for _, entry := range(entries) { + if(entry.Name() == "dotctl") { + continue + } _, err = worktree.Add(entry.Name()) if err != nil { return err