Discard a failed experiment and return to main cleanly
Abandon the current experiment branch and return to main with no changes.
Verify we're on an experiment branch:
git branch --show-currentexperiment/. If not, stop: "You're not on an experiment branch. Nothing to discard."Show what will be lost:
git log main..HEAD --oneline to show commits on this branchgit diff main --stat to show changed filesAsk for confirmation:
<branch>? This deletes all changes on this branch."If confirmed, discard:
BRANCH=$(git branch --show-current)
git checkout main
git branch -D "$BRANCH"
Confirm:
Discarded. Experiment `<branch-name>` deleted.
Back on main, clean slate.
git branch -D (force delete) since the branch is intentionally unmerged.