How to keep local change with git

fr

It’s sometimes useful to keep local modification on a git tracked file, in a config file for example, while working with git, not bothered by local modification.

## ignore local modification, they won’t show with git status anymore
git update-index --skip-worktree FILENAME
## back to normal
git update-index --no-skip-worktree FILENAME

To be noted, doing a git reset --hard will erase all local modification.

Il you want to list all locale modification : git ls-files -v . | grep ^S

Thx to Avdi Grimm : https://avdi.codes/keep-local-modifications-in-git-tracked-files/