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

Artifact Files You Should Have Ignored

Use Case

    ○  h
    ○  g
    │ ○  f
    │ ○  e
    │ ○  d
    │ ○  c
    ├─╯
    ○  b
    ○  a
    ◆
  • You rebase.
    $ jj rebase -s c -o h

    ×  f
    ×  e
    ×  d
    ×  c
    ○  h
    ○  g
    ○  b  <- Binary files added the first time here
    ○  a
    ◆
  • Conflicts.

  • The conflict turns out to involve .bin files that should have been gitignored from the start.

Solution

The idea is:

  • To add the missing item in .gitignore in the Change where binaries were initially added.
  • To collect all edits to bin in a temporary Change, then abandon it.

It works like this:

  • You find the Change that originally added bin:
    $ jj log -r 'files(".bin")'
  • You create a Buffer Change on top of it:
    $ jj new -r b
  • You add the missing item in .gitignore:
    $ echo bin/ > .gitignore
    $ jj squash
  • You collect from the whole history all the edits to bin:
    $ jj squash -f 'files("bin")' bin
  • You abandon the temporary Change:
    $ jj abandon