Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Keeping tracked files local

Sometimes the file is already tracked by the repo, but my version should not be pushed.

Maybe it is a local config file, a credentials-shaped test file, or some machine-specific setting. With jj, I do not leave that as a mysterious dirty file forever. I make it a private change and work with it deliberately.

First I create the private change:

jj new main -m "private: local config"
# edit the local-only tracked file
jj diff

Then I create a merge working copy that combines my real work and the private config:

jj new <work-change> <private-change>

The shape is:

main
  work change --------.
                       \
                        @ combined working copy
                       /
  private: local config'

Now my working tree has both sets of files. When I make real feature changes from this combined view, I move them back into the review change:

jj diff
jj squash -i --into <work-change>
jj diff -r <work-change>

The private change stays local. If I accidentally try to push a commit that includes the private change as an ancestor, git.private-commits stops me. It does not scan file contents, so I still review the target diff before pushing.

This is not secret management. If a real secret escaped to a remote, I would still rotate it. This pattern is for local-only tracked-file changes that I need in my workspace while I work.