复制 Git 中的文件¶
The snow git copy command copies files from given state of the repository (specific branch, tag, or commit) into another stage or local file system.
其中:
-
<REPO_PATH>is a stage path with a specific scope where the value is the repository name followed by a suffix specifying which branch, tag, or commit to copy. The following lists some different types of values:@snowcli_git/branches/main/refers to last commit of the “main” branch@snowcli_git/tags/v2.1.0/refers to a commit taggedv2.1.0.@snowcli_git/commits/1e939d69ca6fd0f89074e7e97c9fd1/refers to a specific commit. Commit hashes should be between 6 and 40 characters long.
存储库路径也可以是存储库中的子目录或文件,但仍然必须加上范围前缀。
<DEST_PATH>is a path to a local directory or to a remote directory on the Snowflake stage.--parallelspecifies the number of threads to use when downloading files.
When <DEST_PATH> specifies a stage, the command operates differently based on its suffix format, as follows:
- If the source ends with a
/, such as@my_snow_git/branches/main/tests/plugin/, the command copies the contents of theplugindirectory into the destination. - If the source does not end with a
/, such as@my_snow_git/branches/main/tests/plugin, the command copies the entireplugindirectory.
示例:将文件从提交复制到暂存区中的目录
This example creates a snowcli2.0/ directory on stage @public and copies all files from the commit marked with tag v2.0.0 into that directory:
示例:将文件从某个目录内部复制到暂存区中的目录
The following example creates a plugin_tests directory on the test_stage stage and copies the contents of the tests/plugin/ directory into it.
示例:将整个目录复制到暂存区中的目录
This example creates a plugin_tests directory on the test_stage stage and copies the entire tests/plugin directory into it. Because tests/plugin does note end with a /, the command copies all of the files to @test_stage/plugin_tests/plugin.
示例:将文件从暂存区中的目录复制到本地文件系统
The following example creates a plugin_tests directory in the local file system and downloads the contents of the tests/plugin directory into it.