GitTip: Skip WorkTree

Use skip-worktree to sneak in modifications git won't notice

GitTip: Skip WorkTree

This tip is simple and powerful in equal parts. What we want to achieve is to modify a local file that git could not identify as having been modified despite being already tracked. For this example, I have a file “config.txt” with the content: “secret.” This file works well in all environments, but in the local environment, I need to change it for testing. No problem: it is modified, the relevant tests are made, it is reverted and it is uploaded.

The problem comes when that file, for various reasons, has to be modified in your local environment and has to work without being uploaded to avoid affecting other files. How can we do that?