Safe git rebasing with backups and recovery. Use when Codex needs to rebase a branch, rewrite history, resolve rebase conflicts, or force-push after a rebase while preserving a rollback path (backup branch/tag or reflog).
feature/foo onto origin/main).--rebase-merges depending on merge commits).--force-with-lease if the branch exists on a remote.git status -sb and confirm the current branch.git fetch --all --prune before rebasing onto remote bases.--rebase-merges.git branch backup/<branch>-<timestamp>git tag backup/<branch>-<timestamp>YYYYMMDD-HHMM to keep backups unique.git rebase <base>git rebase --rebase-merges <base>git rebase -i <base>git status to see conflicted files.git add <files> and git rebase --continue.git rebase --abortgit rebase --show-current-patchgit push --force-with-leasegit switch <branch>git reset --hard backup/<branch>-<timestamp>git push --force-with-lease (only if the remote was updated)origin/main (or the authoritative remote base) rather than a possibly stale local branch.