alpine linuxにおける開発環境 git

インストール

$ apk --no-cache add git

これで何となくは使えます。ただ画面は以下のように単調です。

直感的には分かりにくい…

ここで、唸ってあれこれ試行錯誤。まずは~/.gitconfigに設定値を記入

[user]
        email = xxxxx@example.com
        name = MyName
[color]
        ui = true

[alias]
        co = checkout
        ci = commit
        st = status
        br = branch
        hist = log --graph --pretty=format:\"%C(yellow)%h %C(black bold)%an %Cr
eset%Cred%ad %C(white)%s %Cred%d\" --date=short --stat
        log2 = log --graph --all --name-status --pretty=format:'%Cred%h%Creset
-%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
 --date=relative

[core]
        excludesfile = ~/.gitignore
[color "diff"]
        meta = white bold
        frag = blue
        old = red
        new = green
[pager]
        log = diff-highlight | less

全然、うまくいかない…と、ふとalpineだったことを思い出し

$ apk --no-cache --update add less
$ apk --no-cache add git-diff-highlight

さらに、以下を~/.gitconfigに追加

[core]
        pager = less -+$LESS -FRX
[pager]
        log = diff-highlight | less
色分けと、変更点が反転するようにできた

コメント

タイトルとURLをコピーしました