From da436cd3df4e3e0b57a6f5cd1e58eef5072014b7 Mon Sep 17 00:00:00 2001 From: Philip Peterson Date: Fri, 29 May 2026 21:32:42 -0800 Subject: [PATCH] handle a/b from github --- nixos/aliases.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nixos/aliases.zsh b/nixos/aliases.zsh index f211745..c1b1470 100644 --- a/nixos/aliases.zsh +++ b/nixos/aliases.zsh @@ -3,6 +3,20 @@ alias gb='git branch' alias gs='git status' alias gpcb='git push origin $(git rev-parse --abbrev-ref HEAD)' +function git() { + if [[ $1 == clone && $# -ge 2 ]]; then + local url=$2 + # expand foo/bar -> https://github.com/foo/bar.git (no protocol, no dots in host part) + if [[ $url =~ ^[A-Za-z0-9_-]+/[A-Za-z0-9_.-]+$ ]]; then + url="https://github.com/${url%.git}.git" + echo "Cloning $url" >&2 + fi + command git clone "$url" "${@:3}" + else + command git "$@" + fi +} + alias u='cd ..' alias uu='cd ../..' alias uuu='cd ../../..'