Allow me phrase my attempt first. Let say I have two branch, Alice1 and Alice2. Alice1 has it's own server and Alice2 has his own too. I want to be able to checkout to Alice1, writing my code, then test it on its own server by pushing the code directly using the URL that is saved in the URL config file so it has to stay in local. Alice2 has its own server also, if the code is tested fine on Alice1, I will checkout to Alice2, and sync with Alice1, then push it on Alice2's server. Sometimes I want Alice1 and Alice2 have independent testing environment so they can be seperate until I want to merge them.
I have been researching this for a long time but still not finding a reliable answer. The most popular solution is using .gitattribute and do merge=ours but it has cons that git will sometimes ignore them in forwarding. I also tried checkout file while merging, but this only works in one merge instead of every merging. Gitignore doesn't work obiviously as they don't track this file so all changes in this file will be lost.
Currently, I have two branch, master and dev. There is a file call .clasp.json. I want this file be different in these branches on every checkout, and merge should not touch those files.
I'm thinking if I can write a script that everytime when checkout to a branch, generate the file based on the branch name, I don't know if there is a way of doing it? I found I can use content filter driver, but there isn't a straight forward document out there, any recommandations please?
What I have tried: This method works in one merge, but the file will still get merged in the next merge. https://stackoverflow.com/a/4516022
Whats the Proper usage of .gitattributes with merge=ours This method will only work if there is a merge conflict, which in my case, I won't edit the file after the first edit, I just want it stay different in each branch.