複製せずにgitリポジトリのすべてのファイルを取得する

複製せずにgitリポジトリのすべてのファイルを取得する

次のことができる既存のツールはありますか?

git-cat https://github.com/AbhishekSinhaCoder/Collection-of-Useful-Scripts

then it will run cat on each file in the repo?

次の方法が機能しますが、ファイルは分離されません。

curl -s -H "Accept:application/vnd.github.v3.raw" https://api.github.com/repos/AbhishekSinhaCoder/Collection-of-Useful-Scripts/contents/ | 
jq .[].download_url -r | 
xargs curl 2>/dev/null | 
bat

ベストアンサー1

これはコマンドラインをいくつか変更することで達成できます。

curl -s -H "Accept:application/vnd.github.v3.raw" https://api.github.com/repos/AbhishekSinhaCoder/Collection-of-Useful-Scripts/contents/ | 
jq .[].download_url -r | 
xargs -L1 sh -c 'curl "$0" 2>/dev/null | bat'

ただし、ファイル数が多い場合は、要求が多すぎて速度が制限されたり、ページングによって結果が不完全になる可能性があります。完全な複製コストが発生しないようにするには、浅い複製(git clone --depth=1)または部分複製()を実行することをお勧めします。git clone --filter=blob:none

おすすめ記事