How to conveniently sync a file between two git repositories

三世轮回 提交于 2021-02-04 10:25:08

问题


I have two git local repositories. Both share an identical file, under a different path and under a different name. Currently, when I make changes I have to copy the file from one directory to another.

Is there an alternative way to keep them in sync without manually overwriting the file? I don't want to create a separate repository for this file. I thought one of the following things would work, but apparently, they don't:

  • git submodule
  • git subtree
  • symlink soft
  • symlink hard

What else is there?


回答1:


The only other alternative would be a post-commit hook on repoA, which would, on each commit:

  • check if the file is part of said commit
  • copy it in repoB with the right path.


来源:https://stackoverflow.com/questions/19198787/how-to-conveniently-sync-a-file-between-two-git-repositories

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!