Skip to content

Instantly share code, notes, and snippets.

View leocencetti's full-sized avatar

Leonardo Cencetti leocencetti

View GitHub Profile
[alias]
co = checkout
br = branch
ci = commit
st = status
last = log -1
glog = log --graph --abbrev-commit --pretty=format:'%C(yellow)%h %C(blue)[%G?] %C(green)(%cr)%C(reset) %s'
olog = log --color --abbrev-commit --pretty=format:'%C(yellow)%h %C(blue)[%G?] %C(green)(%cr)%C(reset) %s'
tlog = log --color --abbrev-commit --pretty=format:'%ct %H'
unstage = restore --staged
@leocencetti
leocencetti / git-submodule-status
Last active July 20, 2023 13:00
git-submodule-status
#!/usr/bin/env bash
## constants ##
readonly USE_ANSI_COLOR=$( ([[ "$GBS_USE_ANSI_COLOR" =~ ^[01]$ ]] && echo -n "$GBS_USE_ANSI_COLOR") ||
([[ "$CFG_USE_ANSI_COLOR" =~ ^[01]$ ]] && echo -n "$CFG_USE_ANSI_COLOR") ||
echo -n '1')
readonly CBLUE=$( (($USE_ANSI_COLOR)) && echo '\033[1;34m')
readonly CTHINBLUE=$( (($USE_ANSI_COLOR)) && echo '\e[0;34m')
readonly CEND=$( (($USE_ANSI_COLOR)) && echo '\033[0m')
@leocencetti
leocencetti / git-amendabot
Last active April 8, 2024 15:11
git-amendabot
#!/usr/bin/env bash
set -e
ROOT=$(pwd)
BRANCH=$(gh pr view --json headRefName --jq .headRefName $1)
WORKTREE=worktrees/${BRANCH//\//-}
git fetch origin ${BRANCH}
git worktree add ${WORKTREE} ${BRANCH}
cd ${WORKTREE}