I have a "parameters" file in a repo, which I've added to .gitignore
so it is not being tracked.
I need to push it once so that it shows in the repo, but making sure it is not tracked. This is because I'll keep modifying it (since it stores input parameters) and I only want the default version showing in the repo.
If I git add --force my_params.dat
the file is pushed, but then it keeps being tracked, which I do not want.
What are the correct steps to achieve this? I tend to avoid using git update-index --assume-unchanged FILE_NAME
because I feel it obscures the tracking process, but I'm not strictly opposed to using it.
If I had to use the answers in the question How to make Git "forget" about a file that was tracked but is now in .gitignore?, I'd need to:
remove parameters file from
.gitignore
push file and changed
.gitignore
re-add parameters file to
.gitignore
and pushremove all tracked files with
git rm --cached -r .
re-add all files with
git add .
and push them
This doesn't work because it deletes the parameters file from the repo when I push . That's not what I need.