How does git make the file submit only once, then do not submit any changes to the file, and all the changes will be valid

  git, question

There is a configuration file
A that holds a publishable state on git
However, local testing requires changes to the configuration file.
These changes are not intended to be submitted to git
Previous practices
git update-index --assume-unchanged
Let the local not track files
However, this practice has no effect on other branches.

What orders can achieve the desired effect?

git-extrasA command git lock is provided to realize this function. after submitting the file, the configuration file is locked with the git lock command.

Of course, the implementation of this git lock command is very simple, packaging the functions of git:

Gittadate-index-skip-worktree file path

It has the same effect.