1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

fetch-depth は、GitHub Actions でリポジトリの履歴をどこまで取得するか を決める設定です。

  • fetch-depth: 1 は、最新の1コミットだけ 取ります
  • fetch-depth: 0 は、履歴を全部 取ります

→数字を大きくすると、その分だけ過去のコミットも多く取ります。

例「履歴を全部取ってきてください」

- uses: actions/checkout@v4
  with:
    fetch-depth: 0
  • 1 は速いが、見える範囲が狭い

  • 0 は重いが、Git を自由に使いやすい

fetch-depth は次のような用途で使えます。

  • git diff で差分対象を比較する
  • git merge-base で共通祖先を探す
  • git log で過去の履歴を参照する
  • 変更ファイル数や変更範囲に応じて処理を切り替える

履歴が浅いと、これらのコマンドが「情報不足」で期待通りに動かないことがあります。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?