What is Force push?

Overwriting the online copy of your code's history with your local one, which can erase other work.

Where Force push goes wrong in real apps

Each of these is a short scenario built from a real failure in an app made with AI. Read the answer here, or walk through it yourself in about four minutes.

  • Working with your AI agent · 4 minutes · Pro

    Force-pushed away

    Your agent 'cleaned up the branch' to resolve a conflict. Three days of commits are gone from GitHub.

    How do I recover commits after a force push?

    Act quickly. Git rarely deletes commits immediately: the reflog on the machine that had them, or GitHub's activity history, still shows the old commit ids, and you can recreate a branch from them. Then protect your main branch against force pushes and stop agents pushing without approval.

    Read the fix
  • Working with your AI agent · 4 minutes · Free

    Approve this command?

    Your coding agent wants to clean up old build files before a fresh build. It asks you to approve one command.

    Which AI agent commands should I always check?

    Always read commands that delete, move, reset or force-push before approving them. Shell variables are replaced before a command runs, so an empty variable can turn rm -rf "$HOME/$CACHE_DIR" into deleting your whole home folder. Auto-approve only harmless commands, and run agents in a contained folder.

    Walk it, free
Git, commit, repository
Git saves snapshots (commits) of your code in a repository, so you can see history and go back.
AI coding agent
An AI tool that doesn't just suggest code but runs commands, edits files and installs things for you.
Deploy
Putting a new version of your app online so users get it.

All 62 terms in the glossary