Skip to main content
wit provides powerful commands for modifying commit history. Use these carefully - some operations can permanently alter your repository’s history.

Overview

Revert

Create a new commit that undoes the changes from a previous commit. This is the safest way to undo changes on shared branches.

Options

Examples

Handling Conflicts

Reset

Move the current branch pointer to a different commit. This can also modify the staging area and working directory.

Reset Modes

Revision Syntax

Examples

Danger Zone: wit reset --hard discards changes permanently. Always double-check before using it. Consider wit snapshot first.

Recovering from Hard Reset

Cherry-pick

Apply changes from specific commits to the current branch.

Options

Examples

Handling Conflicts

Use Cases

Rebase

Reapply commits on top of another base commit. This creates a linear history.

Options

How Rebase Works

Examples

Never rebase shared branches: Rebasing rewrites commit history. If others have based work on your commits, rebasing will cause problems. Only rebase local, unpushed commits.

Comparison: When to Use What

Safety Tips

Create a backup first

Check reflog for recovery

Use wit undo

Don't rewrite shared history

Only rebase/reset commits that haven’t been pushed.