I'm in a situation with a git repo where I want to keep a file unchanged, unless the developer specifically knows what they are doing when they change it.
We have a Drupal website in a repo with a custom robots.txt
that we don't want changed. Updating Drupal core involves unpacking a tarball. That means that our custom robots.txt
would get replaced with the stock Drupal robots.txt
. Since Drupal core updates are accepted wholesale (they are mostly security updates), a developer who is perhaps somewhat careless would accidentally overwrite our robots.txt
.
This isn't something you would pick up on in a Pull Request, because there are dozens of files that change in a core update, and you're not going to review all of them. I posted another question, but the answers involved repo/environment changes that are local only, and don't get tracked in the repo. I've done some more research, and this is what I've discovered so far:
skip-worktree
is a local property only; not tracked.assume-unchanged
is a local property only; not tracked..gitignore
-- I tried untracking the file, ignoring it, and then--force
adding it. When I made changes, git still saw them. This is not a solution.- hooks are not tracked in the repo. You can configure them to be tracked, but that involves setting up the local environment for them to start working, and if we're going to do that, why not just set up
skip-worktree
or something else instead.
Is there presently no way to stop a file's changes from from being committed (outside of explicit/extra steps, like a switch) within the repo itself, outside of doing extra local configuration?
The reason I'm posting this question is because I am trying to give my manager a definitive "No, we cannot track this information in the repo. We are going to have to do extra configuration on developer's environments."
I'm using git 2.12.0.windows.1
in git-bash on windows.