Skip to content

Instantly share code, notes, and snippets.

@kusa-mochi
Created February 10, 2022 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kusa-mochi/5adb64bbee3f6be8d1a67a7006c328ee to your computer and use it in GitHub Desktop.
Save kusa-mochi/5adb64bbee3f6be8d1a67a7006c328ee to your computer and use it in GitHub Desktop.
GitHubにあるリポジトリから、特定のフォルダ以下のファイルを、ダウンロード容量を節約しつつ取得するPowerShellスクリプトのサンプル。
# GitHubにあるリポジトリから、特定のフォルダ以下のファイルを、ダウンロード容量を節約しつつ取得するPowerShellスクリプトのサンプル。
$userName = "kusa-mochi"
$repoName = "image-tracer"
$targetFolderPath = "ImageTracer/ViewModels/"
$repoUrl = "https://github.com/${userName}/${repoName}.git"
set-location ../
remove-item $repoName -Recurse -Force
git clone --depth=1 --filter=blob:none --sparse $repoUrl
set-location $repoName
git sparse-checkout init --cone
git sparse-checkout set $targetFolderPath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment