Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Synchronizing single file between two Git repos

Tags:

git

I faced with a trivial situation but it seems like it have no simple solution: I want to synchronize a single config file between two git repositories. It even could be a one-way interaction: origin is stored in project A and is tracked inside project B

I'm aware of git submodule concept, but submoduling of the large repository in the smaller one only for the sake of a single file seems to be overkill.

like image 336
Vitaly Isaev Avatar asked Jul 22 '26 20:07

Vitaly Isaev


1 Answers

You could simply add one repo as a remote and fetch.
Then you can checkout a file from another branch (including a remote tracking one)

git remote add repoA A
git fetch repoA
git checkout repoA/master -- file

(Assuming you want the file from A into repo B)

like image 58
VonC Avatar answered Jul 24 '26 08:07

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!