问题
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