This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# git-worktree-foreach: Runs a command in each worktree directory. | |
set -Eeuo pipefail | |
trap cleanup SIGINT SIGTERM ERR EXIT | |
# Exit if no command is provided | |
if [ "$#" -lt 1 ]; then | |
echo "Usage: git worktree foreach <command>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eu | |
ROOT=$(pwd) | |
BRANCH="" | |
WORKTREE="" | |
match_branch() { | |
echo ">>> Looking up branch for PR $1..." | |
BRANCH=$(gh pr view --json headRefName --jq .headRefName $1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |