How to use Git as a content distribution network

The book 'Git Internal' mentions the use of git as a peer-to-peer content distribution network on p50, but does not have many details. Especially how to have multiple branches that track different files. Example:

(working directory) a00.exe a01.exe b00.exe c00.exe c01.exe c02.exe

The master branch monitors all files, while the A branch only monitors the files a00.exe and a01.exe, the B branches b0000.exe, etc. The following commit will update the a00.exe b00.exe c00.exe file. How to create such branches? As soon as all branches are completed, can I get only a specific branch from the remote? Thank!

+3
source share
2 answers

You will need a script of some kind of assembly for various content branches for you. The main way to do this is to add the contents to the database (in your case, just passing them to the master branch) and then in the temporary index, after reading all the content you want in each branch (git read-tree / git update-index) writing this tree (git write tree), writing a commit object (git commit-tree) and updating the branch to this new commit (git update-links). These are all plumbing commands that are usually not used in everyday operations, but allow you to create snapshots without simultaneously having all the contents in a directory on disk.

An example script to do something like this:

http://github.com/schacon/gitcrazy/blob/master/update_content.rb

, ( "memcache", " " "-" ). :

$ update_content.rb /path/to/content file_name memcache

git db, ( memcache). , git , . ('server/s1', 'server/s2' ..).

, - , script . , . "" script, , .

+7

Source: https://habr.com/ru/post/1725000/


All Articles