Skip to main content
gx oops is a safer, friendlier wrapper around git commit --amend. It lets you fix the last commit message, add forgotten files, or do both at once.

Usage

gx oops [flags]

Flags

FlagShortDescription
--message-mNew commit message
--addFile(s) to add to the last commit (repeatable)
--dry-runShow what would change without making changes
--forceAllow amending even if the commit has already been pushed

Behavior

  • No flags: Opens your editor to amend the commit message interactively
  • -m only: Replaces the commit message
  • --add only: Adds files to the last commit without changing the message (--no-edit)
  • Both -m and --add: Adds files and changes the message in one operation

Examples

$ gx oops -m "fix: resolve login redirect bug"

Last commit: "fix login" (a1b2c3d)

  Amending message:
    Before: "fix login"
    After:  "fix: resolve login redirect bug"

Proceed? [y/N] y

OK Commit message amended.
Pushed commits: By default, gx oops refuses to amend a commit that has already been pushed to a remote branch. Amending pushed commits rewrites shared history and can cause problems for collaborators. Use --force to override this safety check if you know what you are doing.
  • If a file passed to --add does not exist, gx exits with ERROR File not found: <path>
  • If a file passed to --add has no changes (clean in git status), gx skips it with WARN Skipping <file>: no changes detected
  • If all --add files are skipped and no -m is provided, gx prints > No files with changes to add. and exits
  • Using --add . stages everything, similar to git add .