ek9_git_revert
Reports newSha, revertedSha, previousSha, branch, subject, changedFiles and changedFileCount; a conflicting revert aborts with the tree restored.
When to use it
'Undo that commit safely' - one call with ref (a sha, HEAD, a tag); records a NEW inverse commit, so it is safe on already-pushed history. For a merge commit add mainline (the parent to keep, usually 1).
When not to use it
- changes not yet committed - use
ek9_git_restore. - fixing the LAST commit when it is not pushed - use
ek9_git_commitamend:true. - moving branches - use
ek9_git_switch.
Details
ref is verified first (rev-parse) so an unknown ref is refused before any mutation (ref-not-found, with ek9_git_log as the route); a merge commit without mainline is refused (mainline-required), mainline on a non-merge likewise. A revert that hits conflicts is aborted with treeRestored:true - never a half-done state. Shas are the 8-hex short form shared across the family.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
mainline | integer | For a merge commit only: the parent number to keep (usually 1). Omit for an ordinary commit. | |
ref | string | yes | The commit to revert - a short or full sha, HEAD, a tag or any ref. |