Git packaging realizes only incremental packages

You can use the git archive command plus --since and --until parameters to specify the time range, and package the code within the specified time range into a compressed file. Specific steps are as follows: 

Execute the following command to package the code within the specified time range

git archive --format <format> --since <start_date> --until <end_date> --remote <remote_name> <branch_name> > <archive_file_name>.<format>

Among them, --format specifies the packaging format, you can choose zip, tar, gz and other formats; --since and --until specify the time range, the format is YYYY-MM-DD HH:MM:SS; --remote specifies the remote warehouse name, <remote_name> is the name of the remote warehouse, <branch_name> is the name of the branch to be packaged, and > means redirecting the output to the <archive_file_name>.<format> file.

For example, the following command will package the code between January 1, 2021 and January 31, 2021, and output it into the file my-archive.tar.gz:

git archive --format tar.gz --since '2021-01-01' 
--until '2021-01-31' --remote my-remote my-branch > my-archive.tar.gz 

  1. Execute the following command to upload the packaged code to the remote warehouse:

git push <remote_name> <branch_name> <archive_file_name>.<format> 

Among them, <remote_name> is the name of the remote warehouse, <branch_name> is the name of the branch to be uploaded to, and <archive_file_name>.<format> is the name of the packaged file.

For example, the following command uploads the packaged code to the my-branch branch of the my-remote repository:

git push my-remote my-branch my-archive.tar.gz 

Guess you like

Origin blog.csdn.net/qq_22905801/article/details/132286348