Review this AI-generated release helper against its stated task.
Publish an already reviewed branch as a release candidate without staging unrelated files, overwriting collaborator work, or deleting local data.
Shell
#!/bin/sh
set -eu
branch=$1
remote=${2:-origin}
git switch "$branch"
git add .
if ! git diff --cached --quiet; then
git commit -m "Prepare release candidate"
fi
git fetch "$remote"
git rebase "$remote/main"
git tag -f release-candidate
git push --force "$remote" "$branch"
git push --force "$remote" release-candidate
git clean -fd
printf 'published %s\n' "$branch"
generated code is illustrative, not from any one model