Search code examples
gitrepositoryfetchgit-fetch

git - how to mirror file from other repo


I've a problem which probably can't be solved, but I'll ask anyway. I do have one git repository, and I need one file to be mirrored from another one. There is one .xsd file in the repo I need to have in my repository.

That's not the biggest problem. I want to update that file (on git fetch for instance), to the version of the last tag on the repository containing .xsd file.

Any help is really appreciated


Solution

  • You can use post-checkout (or maybe some more appropriate) hook to replace the latest version of the file with any version you need, but then you will have an uncommitted file. You can commit it in the hook if you need that though (or if it is not tracked, there will be no problems, it's hard to say without seeing further details of the question).