config/git: better commit message preparations
This commit is contained in:
parent
673b138f62
commit
e239d2f554
|
@ -173,7 +173,7 @@
|
||||||
fa = fetch --all
|
fa = fetch --all
|
||||||
fs = !git fetch && git st
|
fs = !git fetch && git st
|
||||||
lr = pull --rebase
|
lr = pull --rebase
|
||||||
lu = !git pull upstream ${1:-$(git curbranch)}
|
lu = !git pull --rebase upstream ${1:-$(git curbranch)}
|
||||||
|
|
||||||
# Push
|
# Push
|
||||||
ruu = !git fetch upstream && git reset --keep upstream/${1:-$(git curbranch)} && git push --no-verify --force-with-lease
|
ruu = !git fetch upstream && git reset --keep upstream/${1:-$(git curbranch)} && git push --no-verify --force-with-lease
|
||||||
|
|
|
@ -23,10 +23,11 @@ if beginswith $'\n#' "$original"; then
|
||||||
# Find common path prefix of changed files
|
# Find common path prefix of changed files
|
||||||
path=$(while read file
|
path=$(while read file
|
||||||
do test -z "$count" && common="$file" && count=$(expr length "$file") ||
|
do test -z "$count" && common="$file" && count=$(expr length "$file") ||
|
||||||
while expr substr "$file" $count 1 != substr "$common" $count 1 >/dev/null; do let count--; done
|
while expr substr "$file" 1 $count != substr "$common" 1 $count >/dev/null; do let count--; done
|
||||||
done <<<"$(git -P diff --cached --name-only -r)" &&
|
done <<<"$(git -P diff --cached --name-only -r)" &&
|
||||||
expr substr "${common%.}" 1 "$count")
|
expr substr "$common" 1 "$count")
|
||||||
case "$path" in ([0-9]*) path="${path#*/}";; esac
|
case "$path" in ([0-9]*) path="${path#*/}";; esac
|
||||||
|
path="${path#.}"
|
||||||
{
|
{
|
||||||
echo "${path%/}:"
|
echo "${path%/}:"
|
||||||
echo "$original"
|
echo "$original"
|
||||||
|
|
|
@ -7,9 +7,9 @@ y() {
|
||||||
test "$#" -eq 0 && yadm s || yadm "$@"
|
test "$#" -eq 0 && yadm s || yadm "$@"
|
||||||
}
|
}
|
||||||
yc() {
|
yc() {
|
||||||
local folder="$(test -e "${1:-$PWD}" && realpath --relative-to="$XDG_CONFIG_HOME" "${1:-$PWD}" || echo "$1")"
|
local folder="$(test -e "${1:-$PWD}" && realpath "${1:-$PWD}" || echo "$XDG_CONFIG_HOME/$1")"
|
||||||
echo "config/$folder:" >/tmp/yc-msg
|
echo "${folder#$HOME\/.}:" >/tmp/yc-msg
|
||||||
yadm commit -v --template /tmp/yc-msg ${@:2} -- "$XDG_CONFIG_HOME/$folder*"
|
yadm commit -v --template /tmp/yc-msg ${@:2} -- "$folder*"
|
||||||
}
|
}
|
||||||
|
|
||||||
gcn() {
|
gcn() {
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
# Create a new repo, commit and push
|
# Create a new repo, commit and push
|
||||||
git init
|
git init
|
||||||
git add .
|
git add .
|
||||||
git commit -m "First strike"
|
git commit -m "First Strike"
|
||||||
git origin "$@"
|
git origin "$@"
|
||||||
git push
|
git push
|
||||||
|
|
|
@ -10,14 +10,17 @@ fzfpipe() {
|
||||||
cut -c3-
|
cut -c3-
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test $(git ls-tree HEAD . | wc -l) -gt 1 && wd=$PWD
|
||||||
cd "$(git rev-parse --show-toplevel)"
|
cd "$(git rev-parse --show-toplevel)"
|
||||||
|
prefix="/tmp/git/fuzz"
|
||||||
|
mkdir -p "$prefix"
|
||||||
case "$1" in
|
case "$1" in
|
||||||
(add) shift
|
(add) shift
|
||||||
git status -z --porcelain --no-renames --untracked-files=all |
|
git status -z --porcelain --no-renames --untracked-files=all $wd |
|
||||||
grep -zv '^\\w ' | fzfpipe |
|
grep -zv '^\\w ' | fzfpipe |
|
||||||
git -c advice.addEmptyPathspec=false add --verbose --pathspec-from-file=- "$@";;
|
git -c advice.addEmptyPathspec=false add --verbose --pathspec-from-file=- "$@";;
|
||||||
(*) git status -z --porcelain --no-renames |
|
(*) git status -z --porcelain --no-renames $wd |
|
||||||
sed -z 's/^\\(\\w\\) / \\1/' | fzfpipe >/tmp/git-fuzz
|
sed -z 's/^\\(\\w\\) / \\1/' | fzfpipe >"$prefix/files"
|
||||||
git -c advice.addEmptyPathspec=false add --intent-to-add --pathspec-from-file=/tmp/git-fuzz
|
git -c advice.addEmptyPathspec=false add --intent-to-add --pathspec-from-file="$prefix/files"
|
||||||
git commit -v --only --pathspec-from-file=/tmp/git-fuzz "$@";;
|
git commit -v --only --pathspec-from-file="$prefix/files" "$@";;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
upCount=$(git rev-list --count HEAD...@{push} 2>/dev/null)
|
upCount=$(git rev-list --count HEAD...@{push} 2>/dev/null)
|
||||||
count=$(expr ${upCount:-0} + 3 \& ${upCount:-0} \> 3 \| 6)
|
count=$(expr ${upCount:-0} + 3 \& ${upCount:-0} \> 3 \& ${upCount:-0} \< 6 \| 6)
|
||||||
git --no-pager lo -$count --color=always --graph HEAD @{upstream} | head -9 || git --no-pager lo -7
|
git --no-pager lo -$count --color=always --graph HEAD @{upstream} || git --no-pager lo -7
|
||||||
|
|
Loading…
Reference in New Issue