Turns out the answer is pretty simple.
git update-index --skip-worktree [path] to stop
git from tracking changes to any given file.
If you ever do make changes to that file which you want to commit with
git update-index --no-skip-worktree [path] to make
git start tracking that file again
FYI: The original answer suggested using
--assume-unchanged but it turns out that option can break behavior
when switching branches, while --skip-worktree is intended for this exact
scenario. More details here: Git
- Difference Between 'assume-unchanged' and