2
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?

【Git-Delta】Git-Delta導入 使い方

2
Posted at

概要

Git-DeltaはGit差分のViewer補助ライブラリで、一括置換やバージョン移行ツール後など、差分を大量に確認する際に役に立つ
git diffが圧倒的に見やすくなる

環境はWSL2で確認済み

インストール

# 1. 最新の .deb パッケージをダウンロード (x86_64版)
wget https://github.com/dandavison/delta/releases/download/0.16.5/git-delta_0.16.5_amd64.deb

# 2. インストール
sudo dpkg -i git-delta_0.16.5_amd64.deb

# 3. 確認(バージョンが表示されればOK)
delta --version

Git設定に組み込む

git config --global --edit

.gitconfig
[core]
        pager=delta
[interactive]
        diffFilter = "delta --color-only"
[delta]
        navigate = true
        light = false
        line-numbers = false

diff方法

git diff origin/main..HEAD --stat
git diff origin/main..HEAD -- "*.yml" "*.json"
git diff origin/main..HEAD --side-by-side

テクニック

差分の中をジャンプする
git diff を実行中、以下のキーで高速移動できます。

  • n: 次の差分(ファイルや変更箇所)へジャンプ
  • p: 前の差分へジャンプ
  • Space: ページ送り
  • q: 終了
2
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
2
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?