dotfiles

dot files
git clone git://git.rr3.xyz/dotfiles | git clone gits://git.rr3.xyz/dotfiles
Log | Files | Refs | Submodules

commit 5d4fb81ab5764aab745d601137e5795eb0dd55e7
parent 2c85d0c466226e27e14744927c474e1269e5ea06
Author: Robert Russell <robert@rr3.xyz>
Date:   Mon, 10 Aug 2026 13:54:42 -0700

git: add custom subcommand scripts

Diffstat:
Mgit/.config/git/config | 4----
Mgit/.graft.sh | 5+++++
Agit/.local/bin/git-bmk | 8++++++++
Agit/.local/bin/git-bmksw | 8++++++++
Agit/.local/bin/git-bsw | 8++++++++
Agit/.local/bin/git-unstage | 11+++++++++++
Agit/.local/bin/git-wipe | 14++++++++++++++
7 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/git/.config/git/config b/git/.config/git/config @@ -91,9 +91,6 @@ cloner = clone --recurse-submodules # Branches - bsw = switch - bmksw = switch --create - bmk = "!f() { [ $# -ge 1 ] || exit 1; git branch -- "$@"; }; f" bls = branch --list -- bcp = branch --copy -- bmv = branch --move -- @@ -104,7 +101,6 @@ a = add aa = add --all ap = add --patch - unstage = restore --staged # TODO: Review and clean up # Commit diff --git a/git/.graft.sh b/git/.graft.sh @@ -1,5 +1,10 @@ link .config/git +link .local/bin/git-bmk +link .local/bin/git-bmksw +link .local/bin/git-bsw +link .local/bin/git-unstage +link .local/bin/git-wipe # for f in .local/bin/*; do # link "$f" # done diff --git a/git/.local/bin/git-bmk b/git/.local/bin/git-bmk @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ $# -ne 1 ] && [ $# -ne 2 ]; then + echo "usage: git bmk <name> [<base>]" >&2 + exit 1 +fi + +git branch -- "$@" diff --git a/git/.local/bin/git-bmksw b/git/.local/bin/git-bmksw @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ $# -ne 1 ] && [ $# -ne 2 ]; then + echo "usage: git bmksw <name> [<base>]" >&2 + exit 1 +fi + +git branch -- "$@" && git switch --quiet -- "$1" diff --git a/git/.local/bin/git-bsw b/git/.local/bin/git-bsw @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ $# -ne 1 ]; then + echo "usage: git bsw <name>" >&2 + exit 1 +fi + +git switch --quiet -- "$1" diff --git a/git/.local/bin/git-unstage b/git/.local/bin/git-unstage @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ $# -eq 0 ]; then + set -- . +fi + +if ! git diff --staged --quiet -- "$@"; then + git diff --staged --relative --name-only -- "$@" | sed 's/^/Unstaging /' + git diff --staged --relative --name-only -z -- "$@" | + git restore --staged --pathspec-from-file=- --pathspec-file-nul -- || exit +fi diff --git a/git/.local/bin/git-wipe b/git/.local/bin/git-wipe @@ -0,0 +1,14 @@ +#!/bin/sh + +if [ $# -lt 1 ]; then + echo "usage: git wipe <path>..." >&2 + exit 1 +fi + +if ! git diff --quiet -- "$@"; then + git diff --relative --name-only -- "$@" | sed 's/^/Restoring /' + git diff --relative --name-only -z -- "$@" | + git restore --pathspec-from-file=- --pathspec-file-nul -- || exit +fi + +git clean -fd -- "$@"