I've found numerous topics regarding this, but none that solve the specific problem I'm looking to solve.
I have a configuration file called local.properties in the root directory of my repo. Each developer using the repo will have different values in this configuration file. I would like to have a default file in the repo, such that if a developer clones the repo (or pulls and doesn't have that file, if possible), it will be added, but I don't want to track changes locally (ie. when they make their changes to the file, git should not track it as a modified file). I don't want the developer to have to do any extra git commands to get this working (eg. git update-index --skip-worktree local.properties
), and ideally, I'd like this situation to remain the same even when the repo is forked.
Working from comments on this post, I tried
- pushing the template file upstream, calling
git rm --cached local.properties
, committing, adding the file to.gitignore
, then committing and pushing, but this causes the upstream file to be deleted. - add the file to
.gitignore
, create the template file, force add it withgit add -f local.properties
, commit and push it, but changes are still being tracked (and usinggit rm --cached local.properties
leaves me in the same position as before)
And at least a few other variations on doing these in different orders and with pushes, etc. and I cannot get the file to actually stay in the repository, untracked, with local changes not triggering modifications in the staging area. Is this possible?