dotfiles/.gitconfig

98 lines
3.0 KiB
INI
Raw Normal View History

2024-02-10 12:33:24 +00:00
[user]
name = Kazuhiro MUSASHI
email = simoom634@yahoo.co.jp
[color]
# colorの設定(以下のコマンドは自動で色つける)
status = auto
diff = auto
branch = auto
interactive = auto
grep = auto
[core]
2024-06-10 02:21:26 +00:00
editor = /usr/bin/vim
2024-02-10 12:33:24 +00:00
[alias]
# log関連
logg = !git log --reverse --oneline main..`git symbolic-ref HEAD` | fzf --preview 'git show --oneline --color=always {1}'
# log + graph
graph = log --graph --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'
# status - shorter version
s = status -s -b
# status
st = status
# diff
d = "!f() { args=$@; [ -z \"$args\" ] && args=HEAD; ([ \"$args\" = \"HEAD\" ] && git status --short || git diff --name-status $args | sed 's/\t/ /') | fzf --preview \"echo {} | cut -c 4- | xargs git diff --color=always $args --\" --multi --height 90% | cut -c 4-; }; f"
# checkout
co = "!f() { args=$@; if [ -z \"$args\" ]; then branch=$(git branch --all | grep -v HEAD | fzf --preview 'echo {} | cut -c 3- | xargs git log --color=always'); git checkout $(echo $branch | sed 's#remotes/[^/]*/##'); else git checkout $args; fi }; f"
# commit
c = commit
# init, add, and commit
prep = !git init && git add . && git commit -m \"initial commit\"
# add
a = !git add . && git now
# alias
alias = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\\t => \\2/' | sort
# tags
# http://qiita.com/items/2b9d9560381bbe316818
tags = for-each-ref --sort=-taggerdate --format='%(taggerdate:short) %(tag) %(taggername) %(subject)' refs/tags
# git update
# http://qiita.com/tomy_kaira/items/2e1d575202e14a28b600
update = "!sh -c 'git ft; git rsm; git delete-merged-branches'"
ft = fetch --prune
rsm = update-ref refs/heads/main origin/main
delete-merged-branches = !"brs=`git branch --merged main | grep -Ev '(main|dev)' | grep -v '*'` && git branch -D $brs || true"
up = "!git remote update -p; git merge --ff-only @{u}; git delete-merged-branches"
# git now rebase
nr = "!git now rebase"
# git mkbranch = git co -b [branch name]
mkbranch = checkout -b
# git empty = git commit --allow-empty
empty = commit --allow-empty -m "[WIP] " -e
# git r, meaning `git rebase -i HEAD~` from the 1st commit in the current branch to the last.
r = "!git rebase --keep-empty -i HEAD~$(git log --pretty=oneline main..$(git symbolic-ref HEAD) | wc -l | sed -Ee 's/ +//')"
stl = !git stash list | fzf --preview 'echo {} | grep -o stash@{.*} | xargs git stash show -p --color=always' --height 90% | grep -o stash@{.*}
sta = !git stl | xargs git stash apply
std = !git stl | xargs git stash drop
# git chls
chls = !git log --name-status --oneline main..`git symbolic-ref HEAD` --reverse
[merge]
# from 1.7.6
ff = false
[pull]
# from 1.7.9
rebase = true
2024-02-10 12:33:24 +00:00
[credential]
helper = store --file ~/.git_credentials
helper = cache --timeout 1800
2024-02-10 12:33:24 +00:00
[filter "lfs"]
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
2024-02-10 12:33:24 +00:00
[init]
defaultBranch = main