Generate the exact sequence of Git commands for a described scenario, such as undoing a commit, with the resulting state after each command.
You are a Git tutor who treats every command as something with a real, specific effect on your repository's history, and refuses to hand over a command sequence without saying what state it leaves things in afterward. My scenario is [SCENARIO], described in plain language, exactly what I'm trying to do, such as I committed to the wrong branch and need to move that commit, I need to undo my last commit but keep the changes, or I have a merge conflict and don't know which version to keep. If I left that blank, ask me to describe the situation instead of picking a generic Git scenario to walk through in its place. My current state is [CURRENT_STATE?], anything relevant about where things stand right now, such as whether the commit has already been pushed to a shared remote, since a command that's safe on local-only history can rewrite history other people depend on once it's pushed. If I left that blank and [SCENARIO] involves anything that could be destructive, ask specifically whether the work has been pushed before giving a final answer, instead of assuming either way. Give the exact sequence of commands needed for [SCENARIO], numbered in the order to run them, each one on its own line exactly as it should be typed. After the full sequence, go back through it command by command and explain what that specific command changes, working tree, staging area, local history, or the remote, and what the repository looks like immediately after that command runs. If [SCENARIO] has more than one valid approach, such as reset versus revert for undoing a commit, name the one that fits [CURRENT_STATE] best, and explain in one or two sentences why the other approach would be riskier or wrong for this specific situation instead of listing every option neutrally. If any command in the sequence is destructive or hard to undo, rewriting pushed history, discarding uncommitted changes, mark that specific line clearly before the sequence starts and state exactly what would be permanently lost if it goes wrong, before I run anything. If I report that a command didn't do what you said, ask what the actual output or error message was, then diagnose from that exact message instead of re-explaining the original sequence.
Use this prompt anywhere
10,000+ expert prompts for ChatGPT, Claude, Gemini, and wherever you use AI.
Get Early AccessA generic list of Git commands doesn't help when you're staring at a merge conflict at 11pm. This tool starts from your exact situation, committed to the wrong branch, need to undo a commit, stuck in a conflict, and gives the exact command sequence for it, with a warning up front on anything that could be destructive.
Describe [SCENARIO] in plain language and add [CURRENT_STATE] if it matters, especially whether the work has already been pushed, since a command that's harmless on local-only history can rewrite history someone else depends on once it's shared. The output gives the numbered command sequence first, then walks back through it command by command explaining what each one actually changes, working tree, staging area, local history, or the remote. Where more than one approach exists, reset versus revert, for example, it picks the one that fits your actual situation and says why the other one would be riskier here specifically.
Anything destructive gets flagged before the sequence starts, with exactly what would be lost if it goes wrong. Report back that a command didn't behave as expected and it diagnoses from the real error message instead of repeating the same explanation. Pair it with the command line task explainer for anything outside Git itself, or check an unfamiliar term in the programming term definition explainer.
Run it in the Dock Editor to keep a running log of Git situations you've solved.
Load the prompt into the Dock Editor or your chat tool of choice, then fill in [SCENARIO] in plain language, the actual situation you're in, not the Git term for it, since you might not know the term yet.
Fill in [CURRENT_STATE] with anything that matters, especially whether the commit or branch in question has already been pushed to a shared remote.
A numbered list of the exact commands to run, in order, exactly as they should be typed, no placeholder syntax to decode.
Every command gets explained afterward, what it affects, working tree, staging, local history, or remote, and what your repo looks like right after.
Anything that rewrites pushed history or discards uncommitted work gets flagged clearly before the sequence, with exactly what's at risk if it goes wrong.
Get the exact commands for a real situation, like undoing a bad commit, instead of memorizing a full command reference before you actually need most of it.
Resolve a merge conflict or fix a mis-targeted commit without losing a teammate's work, with the risk of each command flagged clearly first.
Work through common scenarios, branching, rebasing, resolving conflicts, in a safe practice repo before those same situations show up in a real project.
Get a clear, ordered fix for a specific Git mess instead of scrolling through a dozen contradictory Stack Overflow answers to piece one together.
Discover more prompts that could help with your workflow.
Build a small working program that calls a real public API, with the request, response, and API key setup explained step by step.
Explain a core functional programming idea, such as pure functions or immutability, with a broken code example and its fixed version shown side by side.
Explain a built-in math function, square root, power, absolute value, or rounding, covering math and syntax, then generate practice calls to predict before revealing results.
10,000+ expert-curated prompts for ChatGPT, Claude, Gemini, and wherever you use AI. Our extension helps any prompt deliver better results.