Browse Source

git: ++cleanup, deleted; update gitconfig

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

37
etc/soft/git/gitconfig

@ -13,18 +13,18 @@ @@ -13,18 +13,18 @@
pager = delta
editor=nvim
excludesfile = ~/.shellrc/etc/soft/git/gitignore-global
hooksPath = ~/.shellrc/etc/soft/git/hooks/common/
quotepath = false
commitGraph = true
autocrlf = input
safecrlf = warn
askpass =
[delta]
commit-style = box
file-style = box
light = true
navigate = true
syntax-theme = "OneHalfLight"
[fetch]
prune = true
[commit]
template = ~/.shellrc/etc/soft/git/templates/common/commit.txt
[gui]
wmstate = normal
@ -37,6 +37,7 @@ @@ -37,6 +37,7 @@
ff = only
[merge]
conflictstyle = diff3
tool = vimdiff
[help]
@ -57,10 +58,14 @@ @@ -57,10 +58,14 @@
[color "blame"]
repeatedLines = yellow
[status]
showUntrackedFiles = all
# ----[ DIFF METHODS ]--------------------------------------------------------
[diff]
renameLimit = 10240
colorMoved = default
[diff "plist"]
textconv = plutil -p
@ -74,6 +79,18 @@ @@ -74,6 +79,18 @@
[diff "jpg"]
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 ]--------------------------------------------------------
[alias]
@ -137,7 +154,10 @@ @@ -137,7 +154,10 @@
pk = !git archive HEAD --format=zip > `basename $PWD`_`\\date '+%Y.%M.%d'`.zip
# Настройка 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 ]---------------------------------------------------------
@ -170,6 +190,9 @@ @@ -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
# Список удалённых файлов
deleted = !git log --graph --oneline --diff-filter=D --summary
# Журнал действий со ссылками на коммиты
refs = reflog show

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

@ -0,0 +1,37 @@ @@ -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 @@ @@ -0,0 +1 @@
# TEMPLATE
Loading…
Cancel
Save