We have a repo with a file say x.APK that is pulled by client machines.
These client machine will modify this file and keep it locally for their use.
In normal usage we will update this file very rarely say once in 2-3 months.
The first time it will pull the files many along with x.APK and modify it and store it locally. We then update other files and push. On pull in client we get a local change but since x.APK did not change there are no conflicts.
Now is there any way to update x.APK ignoring whatever local changes were made to that file with only git pull.
git pull are done by a script and we cannot access the clients always. so running other commands will be tricky.
We tried:
git update-index --assume-unchanged
this ignores the changes but is not able to pull
Using gitignore it will delete the file from the clients and repo which we don't want.
It is a peculiar case if someone could help out it would be great.
It depends on the nature of the local modification done in x.txt.
If those modifications are well defined (and not all over the place in
x.txt) then you could consider a content filter driver in order to generate the rightx.txton checkout:it means that you do not version
x.txtanymore, but a template version "x.template".git mv x.txt x.txt.tpl.Add
x.txtto your.gitignore.Then, add a smudge script associated to
x.txtfiles in a.gitattributesdeclaration:(image from "Customizing Git - Git Attributes", from "Pro Git book")
The
style_smudgescript can be versioned, and will have to fetch local modification content from a file outside the repo (meaning those a private modification), and inject its content in the template in order to generate the actualx.txt.That way, a
git pullwhich triggers an update of the working tree would automatically re-generatex.txtwith the new updates as well as the local modifications.