豚吐露@wiki

gitconfig

最終更新:

ohden

- view
管理者のみ編集可

git - .gitconfig


gitの設定memo
$ vi ~/.gitconfig
[user]
  name = 【UserName】※"git config --local user.name 【UserName】"で設定するのが望ましい
  email = 【MailAddr】 ※"git config --local user.email 【MailAddr】"で設定するのが望ましい

[core]
  excludesfile = ~/.gitignore
  editor = vim
  pager = cat
  autocrlf = false
  filemode = false
  ignorecase = false
  quotepath = false

[init]
  defaultBranch = main

[pager]
  diff = diff-highlight | less -R -F -X
  show = diff-highlight | less -R -F -X
  log = diff-highlight | less -R -F -X

[credential]
  helper = cache --timeout 10800

[push]
  default = current

[pull]
  rebase = true
  ff = only

[color]
  ui = true

[branch]
  autoSetupMerge = always

[alias]
  graph = log --graph --date-order -C -M --pretty=format:\"<%h> %Cred%ad%Creset [%an] %Cgreen%d%Creset %s\" --all --date=short
  st = status -uall
  ci = commit
  b = branch
  ba = branch --all
  ds = diff --no-prefix --stat
  df = diff --no-prefix
  dfs = diff --stat --no-prefix
  dfw = diff --no-prefix -w --ignore-blank-lines
  dfword = diff --no-prefix --word-diff
  dfc = diff --no-prefix --cached
  dfcw = diff --no-prefix -w --ignore-blank-lines --cached
  dfcword = diff --no-prefix --cached --word-diff
  clear = clean -df
  co = checkout
  g = grep -IEn
  gi = grep -iIEn
  r = remote
  l = log --pretty=format:\"%h %Cred%ad%Creset [%an] %Cgreen%d%Creset %s\" --date short
  ln = log --name-status --date=short --decorate=full
  lp = log -p --no-prefix --date=short --decorate=full
  lpw = log -p -w --no-prefix --date=short --decorate=full
  a = add
  au = add -u
  cp = cherry-pick -x
  ls = ls-files -t
  ll = ls-files -cdmokt
  stash = stash -u
  rm = rm --cached
  sw = switch

diff-highlightの利用方法
上記の設定をするには、以下のdiff-highlightが無いとダメ。
最初から実行fileがありゃぁシンボリックリンク作るだけで大丈夫なんじゃが、無かったらmakeするところからやらんとダメ。
でもあった方が見易いんで、頑張った方が良い。

環境
Ubuntu 18.04.1 LTS on WSL

手順
$ cd /usr/share/doc/git/contrib/diff-highlight
$ sudo make
perlからdiff-highlightが作られて実行権が与えられる。

binaryが置いてあるので、実行権与えて、シンボリックリンクを貼る。
$ sudo chmod +x /usr/share/doc/git/contrib/diff-highlight/diff-highlight 
$ cd /usr/local/bin/
$ sudo ln -s /usr/share/doc/git/contrib/diff-highlight/diff-highlight diff-highlight
で、上記のgitconfigのようにpagerにdiff-highlightが設定しててもerrorが出んくなる。



更新日: 2025年04月30日 (水) 02時03分32秒

  • ~/.config/git/ignore にglobalなignoreを追加するらしい -- (s1n) 2018-08-13 16:47:53
名前:
コメント:

すべてのコメントを見る
記事メニュー
ウィキ募集バナー