Skip to content

Instantly share code, notes, and snippets.

@ernesto-jimenez
Created September 14, 2024 21:22
Show Gist options
  • Save ernesto-jimenez/e4fec041da72736f127b8511a467234e to your computer and use it in GitHub Desktop.
Save ernesto-jimenez/e4fec041da72736f127b8511a467234e to your computer and use it in GitHub Desktop.
Push graphite stack to git directly
#!/usr/bin/env sh
set -e
current_branch=$(git rev-parse --abbrev-ref HEAD)
gt ls -s -r | rg '(?<branch>[^ ]+)$' -o | rg -v '^(main|master)$' | \
while read -r branch; do
gt co "${branch}"
git push --force-with-lease
done
gt co "${current_branch}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment