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
.binfiles that should have been gitignored from the start.
Solution
The idea is:
- To add the missing item in
.gitignorein the Change where binaries were initially added. - To collect all edits to
binin 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