Last active
April 8, 2024 15:11
-
-
Save leocencetti/bf6e3d215070af7e1cd2579da674a388 to your computer and use it in GitHub Desktop.
git-amendabot
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 -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} | |
git commit -q --amend --no-edit | |
git push -q -f | |
cd ${ROOT} | |
git worktree remove -f ${WORKTREE} | |
git branch -D ${BRANCH} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment