I have certain files that I need to have different on a staging server from a clients repo. One for example is the .htaccess file.
I don't want locally modified files to be tracked so I added it to .git/info/exclude
I then ran git update-index --assume-unchanged .htaccess
(I also tried --skip-worktree
)
But now when I try to switch branch git checkout myotherbranch
I get this message:
error: Your local changes to the following files would be overwritten by checkout: .htaccess Please commit your changes or stash them before you switch branches. Aborting
But because I am ignoring the file I can't stash it.
I actually have many files locally ignored, I just have just shortened example to one file for simplicity.
I think the issue is that the branch I am switching into has a different .htaccess file version than my current branch.
Is there any way to switch into this branch while having the file locally ignored?
Edit for close vote: please read my question. removing the file from repository is not the answer. i am locally ignoring file so it is independant of main repo. This would effect main repo. I only want it excluded locally and to have ability to change branches.