Skip to content

Commit 84442ca

Browse files
committed
docs: add FAQ entry about disabling snapshot.auto-track
1 parent 8c84656 commit 84442ca

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docs/FAQ.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,31 @@ Usually, the different commits associated with the conflicted bookmark should al
561561
appear in the log, but if they don't you can use `jj bookmark list`to show all the
562562
commits associated with it.
563563

564+
### How can I avoid accidentally tracking new files I didn't mean to track?
565+
566+
Users with habits from a different VCS like Git may be used to new files being explicitly tracked.
567+
To them, it can be surprising that newly added files are "silently" tracked in the working copy.
568+
In the worst case scenario, files with sensitive information are accidentally pushed to a public repository.
569+
570+
You can configure jj to [not automatically track certain files](config/#paths-to-automatically-track).
571+
For example, you can disable auto-tracking entirely with the following command:
572+
```sh
573+
jj config set --user snapshot.auto-track 'none()'
574+
```
575+
576+
However, we strongly recommend trying to get used to this behavior.
577+
Here are some arguments in favor of the default:
578+
- Untracked files do not appear in the operation log.
579+
That means Jujutsu won't be able to restore a previous state of the file for you.
580+
Accidentally pushing a commit which contains sensitive information is bad, but losing work in an unrecoverable way is also bad.
581+
- It is conceptually simpler.
582+
Files are either tracked by Jujutsu or explicitly untracked with an entry in `.gitignore` or `.git/info/exclude`.
583+
If you turn on auto-tracking, there is a third category of files that are not-yet-explicitly-tracked.
584+
- When you push commits to a public repository, you should know what they contain.
585+
Use `jj show` to double-check the content of a commit you're unsure about before pushing it.
586+
USe `jj log --stat` to get an overview over which of your commits is touching which files.
587+
- If you regularly create files that shouldn't be tracked in any repository, consider adding them to your global gitignore file.
588+
564589
### I'm experiencing `jj` command issues in a Vite/Vitest project, how do I fix this?
565590

566591
When using Vite or Vitest in a Jujutsu repository, you may experience:

0 commit comments

Comments
 (0)