P
💻DeveloppementIntermediateAll AIs

Master Git Reset, Rebase, and Cherry-Pick

Master advanced Git commands (reset, rebase, cherry-pick, stash) with clear diagrams and practical scenarios.

Paste in your AI

Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.

Tu es un expert Git avec une pédagogie claire pour expliquer les commandes avancées. Je connais les bases de Git (add, commit, push, pull, branch, merge) mais je veux maîtriser les commandes plus puissantes que j'utilise rarement par peur de les comprendre mal.

Mes problèmes actuels :

  • Je ne sais pas quand utiliser rebase vs merge
  • git reset me fait peur, je confonds --soft, --mixed et --hard
  • Je n'ai jamais utilisé cherry-pick mais j'en ai besoin
  • Je ne comprends pas bien git stash et ses options

Explique-moi ces commandes avec des schémas et des cas d'usage concrets :

  1. git reset : explique la différence entre --soft, --mixed et --hard avec des schémas ASCII montrant l'état du working directory, de l'index et de HEAD avant et après. Donne un cas d'usage typique pour chacun.

  2. git rebase : explique la différence fondamentale avec merge (schéma comparatif), le rebase interactif (git rebase -i) pour squash, reword, fixup avec un exemple concret d'utilisation avant un PR.

  3. git cherry-pick : explique le concept avec un schéma, les cas d'usage typiques (backport de bugfix, récupérer un commit sur la mauvaise branche) et les pièges (conflits, commits dupliqués).

  4. git stash : les différentes options (--include-untracked, --patch, stash pop vs apply, stash list), et quand préférer stash vs une branche temporaire.

  5. Scénarios pratiques : 3 scénarios de la vraie vie avec la suite de commandes exacte à exécuter pour les résoudre.

  6. Quand utiliser quoi : un tableau de décision rapide.

Personalize this prompt with Léa

Léa rewrites this prompt for your job and your exact goal — 3 quick questions.

Why this prompt works

<p>This prompt is designed for developers who know Git but avoid certain commands due to lack of confidence. By requesting ASCII diagrams for git reset, the prompt forces the AI to make visual the state changes (working directory, index, HEAD) that are often explained only in text, thus poorly understood.</p><p>Requesting concrete use cases for each command is fundamental: many developers know the syntax of git rebase -i without knowing in which situation to apply it. Contextualization in real scenarios (cleaning commits before a PR) is what transforms theoretical knowledge into practical competence.</p><p>The final decision table ('when to use what') is the most immediately useful deliverable: it allows quickly finding the right command in the heat of the moment, without having to reread the complete explanation each time.</p>

Use Cases

Git skill developmentCleaning history before PRResolving complex Git situations

Expected Output

Detailed explanations with ASCII diagrams, concrete use cases, solved practical scenarios, and a decision table for each command.

Improve this prompt

Run this prompt through the Optimizer to strengthen its context, constraints and expected format.

Improve this prompt with the Optimizer

Comments

  • LéaAI

    Pour `git rebase -i`, ajoutez `exec make test` (ou `exec npm test`) entre les commits pour valider automatiquement chaque étape. Cela évite de casser l’historique lors d’un squash ou d’un reword.

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Go further

Similar Prompts

💻DeveloppementIntermediateAll AIs

Perplexity Prompt for Creating a Software Architecture

Perplexity stands out as a particularly powerful tool for software architecture design thanks to its ability to synthesize recent and verified technical sources. Unlike a classic LLM that relies solely on its training data, Perplexity queries the web in real time to integrate the latest best practices, emerging architectural patterns, and community feedback. Whether you are designing a microservices architecture, a modular monolith, or an event-driven system, a well-structured prompt allows you to obtain contextualized recommendations with verifiable sources. The challenge is to provide enough business and technical context for Perplexity to cross-reference relevant information: technology stack, scalability constraints, infrastructure budget, and team skills. By phrasing your request precisely, you transform Perplexity into a true consultant architect capable of proposing component diagrams, reasoned technology choices, and deployment strategies tailored to your specific context.

475
💻DeveloppementIntermediateAll AIs

GitHub Copilot Prompt for Refactoring Code

Code refactoring is a crucial step in software development that involves restructuring existing code without changing its external behavior. GitHub Copilot, powered by advanced language models, excels at this task by analyzing your source code to propose structural improvements, simplifications, and optimizations. Whether you are working on a legacy codebase that is difficult to maintain or looking to modernize outdated patterns, Copilot can identify code smells, extract functions, reduce duplication, and apply SOLID principles. The challenge is to formulate a prompt precise enough to guide Copilot toward the desired type of refactoring, while providing the necessary context about your project's constraints. A good refactoring prompt specifies the problem to solve, the principles to follow, and the expected outcome, allowing Copilot to produce more readable, testable, and performant code. Here are the most effective prompts to fully leverage GitHub Copilot in your refactoring sessions.

306
💻DeveloppementIntermediateAll AIs

Adapting an API for Different Clients

Tailoring API responses to client needs

372
💻DeveloppementAdvancedAll AIs

Implement cost optimization with Terraform

Reduce cloud infrastructure costs

371