Browse Source

git: ++cleanup, deleted; update gitconfig

master
Maxim Likhachev 3 years ago
parent
commit
dca1f0f865
  1. 35
      etc/soft/git/gitconfig
  2. 37
      etc/soft/git/hooks/common/prepare-commit-msg
  3. 1
      etc/soft/git/templates/common/commit.txt

35
etc/soft/git/gitconfig

@ -13,18 +13,18 @@
pager = delta pager = delta
editor=nvim editor=nvim
excludesfile = ~/.shellrc/etc/soft/git/gitignore-global excludesfile = ~/.shellrc/etc/soft/git/gitignore-global
hooksPath = ~/.shellrc/etc/soft/git/hooks/common/
quotepath = false quotepath = false
commitGraph = true commitGraph = true
autocrlf = input autocrlf = input
safecrlf = warn safecrlf = warn
askpass = askpass =
[delta] [fetch]
commit-style = box prune = true
file-style = box
light = true [commit]
navigate = true template = ~/.shellrc/etc/soft/git/templates/common/commit.txt
syntax-theme = "OneHalfLight"
[gui] [gui]
wmstate = normal wmstate = normal
@ -37,6 +37,7 @@
ff = only ff = only
[merge] [merge]
conflictstyle = diff3
tool = vimdiff tool = vimdiff
[help] [help]
@ -57,10 +58,14 @@
[color "blame"] [color "blame"]
repeatedLines = yellow repeatedLines = yellow
[status]
showUntrackedFiles = all
# ----[ DIFF METHODS ]-------------------------------------------------------- # ----[ DIFF METHODS ]--------------------------------------------------------
[diff] [diff]
renameLimit = 10240 renameLimit = 10240
colorMoved = default
[diff "plist"] [diff "plist"]
textconv = plutil -p textconv = plutil -p
@ -74,6 +79,18 @@
[diff "jpg"] [diff "jpg"]
textconv = exiftool textconv = exiftool
[delta]
commit-style = box
file-style = box
light = true
navigate = true
syntax-theme = "OneHalfLight"
side-by-side = false
[interactive]
diffFilter = delta --color-only
# ----[ ALIASES ]-------------------------------------------------------- # ----[ ALIASES ]--------------------------------------------------------
[alias] [alias]
@ -139,6 +156,9 @@
# Настройка remote на code.envrm.info # Настройка remote на code.envrm.info
my-remote = "!remote() { git remote add origin https://code.envrm.info/src/$(basename "$(pwd)").git; }; remote" my-remote = "!remote() { git remote add origin https://code.envrm.info/src/$(basename "$(pwd)").git; }; remote"
# Удаление принятых в master веток
cleanup = "!git branch --merged | grep -v '\\*\\|master' | xargs -n 1 git branch -d"
# ----[ CLONE ]--------------------------------------------------------- # ----[ CLONE ]---------------------------------------------------------
# Клонирование репозитория code.envrm.info # Клонирование репозитория code.envrm.info
@ -170,6 +190,9 @@
# Локальные изменения, готовые к отправке на сервер # Локальные изменения, готовые к отправке на сервер
lu = !git --no-pager log --left-right --pretty=format:'%C(yellow)%h%Creset - %Cgreen[%cd]%Creset :: %s %C(bold blue)%Creset' --abbrev-commit --graph --color --date=short origin/master...HEAD | nl lu = !git --no-pager log --left-right --pretty=format:'%C(yellow)%h%Creset - %Cgreen[%cd]%Creset :: %s %C(bold blue)%Creset' --abbrev-commit --graph --color --date=short origin/master...HEAD | nl
# Список удалённых файлов
deleted = !git log --graph --oneline --diff-filter=D --summary
# Журнал действий со ссылками на коммиты # Журнал действий со ссылками на коммиты
refs = reflog show refs = reflog show

37
etc/soft/git/hooks/common/prepare-commit-msg

@ -0,0 +1,37 @@
#!/usr/bin/env bash
NUM_COMMITS=5
JIRA_TASK=$(git rev-parse --abbrev-ref HEAD |& grep -E -o '^[a-zA-Z]+-\d+')
COMMITS="$(git log --pretty="# %h %s [%an]" --no-merges -${NUM_COMMITS})"
HEADER="#
# ----------------------"
template() {
[[ -n "${JIRA_TASK}" ]] && echo "# ${JIRA_TASK}"
cat <<-EOF
# Last ${NUM_COMMITS} commits:
# ----------------------
${COMMITS}
EOF
}
COMMIT_FILE=$1
SOURCE=$2
SHA=$3
case "${SOURCE}" in
merge|squash|message)
;;
""|commit|template)
if [[ -z "${SHA}" ]]; then
template > "${COMMIT_FILE}"
fi
;;
*)
echo "Unexpected type '${SOURCE}' in prepare-commit-msg hook" >&2
exit 1
esac

1
etc/soft/git/templates/common/commit.txt

@ -0,0 +1 @@
# TEMPLATE
Loading…
Cancel
Save