---
title: "Commit, push and undo"
description: "My changes stay in your folder until you decide. Commit them, push them, or put everything back exactly as it was."
---

When I finish a change, it sits in your folder as ordinary edits. Nothing is
committed and nothing is pushed until you say so.

> Diagram: Nothing is committed or pushed until you say so; after a push, your own CI is the independent check.

Look first:

```text
/diff
```

## Commit

```text
/commit
/commit fix: clamp partial refunds
/commit --branch refunds fix: clamp partial refunds
/commit --branch refunds --new
```

Or just say it: *"commit this on a new branch called refunds"*.

| You give | I do |
|---|---|
| No branch | I create a new branch named after the work (`ysra/…`) and commit there |
| `--branch name`, and it doesn't exist | I create it and commit there |
| `--branch name`, and it exists | I add my commit to it **without switching your folder**. If my changes conflict with that branch, I stop, name the files, and write nothing |
| `--new` | The branch must be new. If the name is taken, I stop instead of reusing it |

What a commit contains:

- **only the files I changed.** Your own uncommitted work stays uncommitted,
  right where it is;
- your hooks run as usual. I never skip them.

`/commit` never pushes.

![Committing onto a branch, then pushing, in the terminal](../assets/screens/cli/commit.webp){ width="1634" height="836" }
/// caption
Committing onto an existing branch, then the question before a push
///

## Push

```text
/push
/push --branch refunds
```

`/push` commits (same rules as above) and then pushes. I ask before the push,
**every time**, auto mode included, and tell you the remote and branch.

- I only push a branch I created or committed onto in this conversation.
- **Never forced.** If the remote has moved ahead, the push is rejected and I
  tell you. I don't overwrite anything.

## Your CI, read back

After a push, I watch your repository's own checks and report in the
conversation:

```text
Your CI passed on ysra/partial-refunds (4 checks green).
Your CI failed on ysra/partial-refunds: test. Want me to look into it?
```

I read it with tools you already have signed in: `gh` for GitHub, `glab` for
GitLab. I only read. If neither is installed or signed in, I say that I can't
see your CI from here.

## Undo

```text
/undo
```

> Diagram: Undo restores exactly what I changed, or refuses rather than guess.

`/undo` puts back exactly the files my last finished task changed:

- a file I edited goes back to what it was before I started;
- a file I created is removed;
- **your own changes stay.**

![The undo confirmation in the terminal](../assets/screens/cli/undo.webp){ width="1698" height="646" }
/// caption
Undo asks first
///

I ask before doing it. I refuse, and say why, when:

- you've edited those files since. I won't overwrite your work;
- the changes are already committed. Undoing a commit means a new commit that
  reverts it, never rewriting history. Ask me for that instead;
- I'm still working. Use `/cancel` first.

To go further back, `/checkpoints` lists earlier points in the conversation and
`/rewind SEQ` restores one.

## What I never do in your Git

No matter how I'm asked:

- no force push;
- no deleting branches, tags or stashes;
- no `reset --hard`, `clean`, `rebase`, or amending your commits;
- no checking out over your uncommitted changes;
- no Git change you didn't ask for in this conversation.

I track my own work separately, outside your folder, so your history is never
touched to make undo and diff possible.
