Skip to content

Commit

Permalink
Make reverting to old branch more robust
Browse files Browse the repository at this point in the history
by
- ignoring merge abort problems
- stashing/popping local changes to clean up branches
  • Loading branch information
ascheman committed Jan 21, 2024
1 parent 8cfdae9 commit dc4b5dc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/review/rollback.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

: "${REVIEW_BASE_BRANCH:=main}"

git merge --abort
git checkout "${REVIEW_BASE_BRANCH}"

set -euo pipefail

git merge --abort || echo "Skipping merge rollback"
git stash save
git checkout "${REVIEW_BASE_BRANCH}"
git stash pop

if ! type -p gh >/dev/null; then
echo "Please install the 'gh' tool, e.g., via Homebrew: brew install gh" >&2
exit 1
Expand Down

0 comments on commit dc4b5dc

Please sign in to comment.