I want to make a tool that can quickly get from the git-controlled directory, find all the changed files, and form an upgrade package to facilitate the upgrade work on the server.
(We need to copy the upgrade package to the server and then overwrite the contents of the upgrade package directly to complete the upgrade)
Previously this upgrade package was always created manually, which is cumbersome, especially if the files are more fragmented.
General idea:
1. You can use Git diff--name-only to get a list (this shows only a list of files that have not yet been commit)
crontabs/php/create_data_into_sku_flowtype_storage.php
crontabs/php/crontab_script_base_import_to_db.php
This list contains all new or modified directories and files, just follow the list "prescription".
2. According to the information prompted in this file, progressive decomposition to get the corresponding path
crontabs/php/create_data_into_sku_flowtype_storage.php
Then, determine if this information specifies whether the parent path (crontabs/php/) exists.
Does not exist, it is created in turn.
Then determine if this is a directory, and if so, add the corresponding directory under the target path (do not copy),
If it is not a directory (it is a file), copy it.
Note that catalogs do not replicate.
Alternatively, you can use git log--oneline to view the history
Resources:
Chen Jiebin, "Git extracts the diff files from two versions and packs", 2013-09-11, http://www.01happy.com/git-extract-different-files/
The above describes the automatic generation of the upgrade package git, including aspects of the content, I hope to be interested in PHP tutorial friends helpful.