GitHub Crash Course
Git and GitHub are essential tools for modern software development. Use these prompts with your AI coding agent to get a personalized, step-by-step tutorial tailored to your specific development environment.
Fundamentals
Start here if you're a complete beginner. This prompt will teach you the core concepts and commands.
I'm a complete beginner who needs to learn GitHub for my project. I'm using [INSERT YOUR CODING AGENT NAME - e.g., "Cursor", "Replit", "Bolt.new", "VS Code", etc.] as my development environment.
Teach me step-by-step:
1. What is Git vs GitHub and why I need it
2. How to create a repository
3. Basic commands: commit, push, pull
4. Understanding branches (creating, switching, merging)
5. What is main/master branch
6. How to handle merge conflicts
7. What are forks and when to use them
8. Basic workflow for solo projects
9. How to roll back mistakes
Format each section with:
- Plain English explanation
- Exact commands to type
- When to use this feature
- Specific instructions for [MY CODING AGENT] if it has built-in GitHub featuresProject Setup
Use this prompt when you have an existing project that you want to connect to a new GitHub repository.
I need to connect my current project to GitHub. I'm working in [INSERT YOUR CODING AGENT NAME] and my project is [DESCRIBE YOUR PROJECT].
Walk me through:
1. Creating a new GitHub repository for this project
2. The exact terminal commands to initialize Git (if needed)
3. How to make my first commit with all current files
4. Pushing to GitHub for the first time
5. Setting up a .gitignore file for my project type
6. How to update GitHub when I make changes
Give me copy-paste-ready commands with explanations for each step. Include any special considerations for [MY CODING AGENT].Collaboration Workflow
This prompt covers the essentials of working with others or managing multiple features on your own.
I want to collaborate with others or manage different features. Using [INSERT YOUR CODING AGENT NAME], teach me:
1. How to create a feature branch for new work
2. Working on branches without breaking main
3. Pulling latest changes from main
4. Merging branches back to main
5. Handling "merge conflict" errors step-by-step
6. Using pull requests (PRs)
7. Reviewing code changes before merging
8. Emergency: how to undo my last commit/push
Provide real examples with actual commands I can use right now.Key Concepts Explained
Since visual aids aren't possible, here are simple text-based explanations of the most important GitHub terms:
- **Repository (Repo):** Think of it as a folder for your project. It contains all your project's files and the entire history of revisions.
- **Commit:** A snapshot of your files at a specific point in time. Each commit has a unique ID and a message describing the changes you made.
- **Branch:** A parallel version of your repository. You create branches to work on new features without changing the main version of your code (the "main" branch).
- **Main Branch:** This is the definitive, official version of your project. It should always be stable and working.
- **Merge:** The process of taking the changes from one branch and applying them to another. This is how you integrate a new feature into the main branch.
- **Pull Request (PR):** A formal proposal to merge your changes from your feature branch into the main branch. It allows others to review your code, discuss it, and suggest changes before it becomes part of the main project.
- **Conflict:** When you try to merge two branches that have competing changes on the same line of code, Git can't decide which one is correct. This is a merge conflict, and you have to manually resolve it.
Best Practices for Beginners
- **Commit Often:** Make small, frequent commits rather than one giant one. This makes it easier to track changes and roll back if something goes wrong.
- **Write Good Commit Messages:** A clear message explains *why* you made a change, not just *what* you changed. (e.g., "Fix: Prevent crash when user clicks logout" is better than "updated script").
- **Always Use Branches for New Features:** Never work directly on the main branch. Create a new branch for every new feature, bugfix, or experiment.
- **Pull Before You Push:** Before pushing your new commits to GitHub, always pull the latest changes from the main branch to make sure you have the most up-to-date version.