How To Use Github Copilot How To Use Github Copilot

How to Use GitHub Copilot: Complete Beginners Guide (2025)

Learn how to use GitHub Copilot effectively. Step-by-step guide covering installation, shortcuts, best practices, and tips to get 10x more productive.

When GitHub Copilot first launched in 2021, I was sceptical. An AI that writes code for you? Sounded too good to be true. I signed up for the beta anyway, installed it, and… had no idea what I was doing.

The suggestions appeared, but I didn’t know when to use them, how to make them better, or which keyboard shortcuts mattered. I probably used about 10% of Copilot’s capabilities for the first two weeks.

After using GitHub Copilot daily for over two years now, I’ve learned all the tricks that make it genuinely useful. The difference between a Copilot beginner and someone who knows how to use it properly is massive—we’re talking 2-3x productivity gains.

Let me show you everything I wish someone had explained when I started. This is the complete guide to using GitHub Copilot effectively in 2025.


Quick Start Summary

Here’s what you need to know upfront:

What You’ll Learn:
– How to install GitHub Copilot in your IDE
– How to accept, reject, and cycle through suggestions
– How to write code that gets better Copilot suggestions
– Essential keyboard shortcuts that save hours
– Advanced tips for 10x productivity
– Common mistakes to avoid

Prerequisites:
– Active GitHub account
– Supported IDE (VS Code, JetBrains, Neovim, or Visual Studio)
– $10/month subscription (or student/open-source free access)
– Basic programming knowledge

Time Investment: 10 minutes to install, 30 minutes to learn basics, 1-2 days to build muscle memory


Step 1: Get GitHub Copilot

Sign Up for Copilot

Before installing the extension, you need an active subscription:

  1. Go to github.com/features/copilot
  2. Click “Start my free trial” (30 days free)
  3. Sign in to GitHub
  4. Choose plan:
  5. Individual: $10/month or $100/year
  6. Business: $19/user/month (for teams)
  7. Complete payment setup

Free access options:
– Students with GitHub Student Developer Pack
– Maintainers of popular open-source projects
– Check if your employer has a GitHub Business subscription

Install the Extension

For VS Code (most common):
1. Open VS Code
2. Click the Extensions icon (or press Cmd+Shift+X / Ctrl+Shift+X)
3. Search “GitHub Copilot”
4. Click “Install” on the official GitHub extension
5. Also install “GitHub Copilot Chat” for the chat feature
6. Restart VS Code
7. Sign in to GitHub when prompted

For JetBrains IDEs (IntelliJ, PyCharm, WebStorm, etc.):
1. Open your IDE
2. Go to Settings/Preferences → Plugins
3. Search “GitHub Copilot”
4. Install the official plugin
5. Restart IDE
6. Sign in to GitHub

For Neovim:
1. Install using your plugin manager
2. For vim-plug: Plug 'github/copilot.vim'
3. Run :Copilot setup in Neovim
4. Follow authentication prompts

For Visual Studio:
1. Open Visual Studio
2. Extensions → Manage Extensions
3. Search “GitHub Copilot”
4. Install and restart


Step 2: Understanding How Copilot Works

Before diving into usage, understanding how Copilot thinks helps you work with it better:

What Copilot Sees

When generating suggestions, Copilot considers:
– The file you’re currently editing
– Open files in your editor
– File name and extension
– Code before your cursor (up to a few thousand characters)
– Comments near your cursor
– Your cursor position

What it doesn’t see:
– Your entire repository (unless you use Chat to @mention files)
– Files you haven’t opened recently
– Your project’s documentation
– External APIs or libraries (beyond common ones)

This is why context matters so much when using Copilot.

How Suggestions Appear

Copilot shows suggestions in gray inline text as you type. There are typically multiple suggestions available, and you can cycle through them.

The suggestion triggers when you:
– Pause typing for a moment
– Press Enter to start a new line
– Type an opening brace or parenthesis
– Write a comment describing what you want


Step 3: Basic Usage – Accept, Reject, Cycle

These are the fundamentals you’ll use hundreds of times per day:

Accept a Suggestion

Keyboard shortcut: Tab

When you see a gray suggestion that looks good:
1. Press Tab to accept the entire suggestion
2. Copilot inserts the code at your cursor
3. Your cursor moves to the end of the inserted code
4. You can continue typing normally

Pro tip: You can partially accept suggestions. Accept with Tab, then immediately delete the parts you don’t want. This is often faster than cycling through alternatives.

Reject a Suggestion

Keyboard shortcuts:
Esc – Reject and clear the suggestion
– Just keep typing – The suggestion disappears automatically

If a suggestion is completely wrong or unhelpful, just ignore it and type what you actually want. Copilot will adjust based on what you type.

Cycle Through Alternative Suggestions

Keyboard shortcuts:
Option+] (Mac) or Alt+] (Windows/Linux) – Next suggestion
Option+[ (Mac) or Alt+[ (Windows/Linux) – Previous suggestion

Copilot usually has 3-10 alternative suggestions. I cycle through them when:
– The first suggestion is close but not quite right
– I want to see different approaches
– The first suggestion is too verbose or too simple

Real example from yesterday:

I typed:

def send_email(

First suggestion:

def send_email(to, subject, body):
    # send email using SMTP
Code language: PHP (php)

I pressed Option+] to see more. Third suggestion:

def send_email(to, subject, body, attachments=None):
    """Send email with optional attachments."""
    # implementation
Code language: PHP (php)

Better! Accepted with Tab.


Step 4: Writing Code That Gets Better Suggestions

This is the game-changer. How you write code dramatically affects suggestion quality.

Use Descriptive Names

Bad (vague):

function calc(a, b) {
Code language: JavaScript (javascript)

Copilot suggests:

function calc(a, b) {
  return a + b; // Generic addition
}
Code language: JavaScript (javascript)

Good (specific):

function calculateCompoundInterest(principal, rate, years) {
Code language: JavaScript (javascript)

Copilot suggests:

function calculateCompoundInterest(principal, rate, years) {
  const amount = principal * Math.pow(1 + rate/100, years);
  return amount - principal;
}
Code language: JavaScript (javascript)

See the difference? Specific names give Copilot context.

Write Comments First

This technique is incredibly powerful. Write a comment describing what you want, then press Enter:

# Create a FastAPI endpoint that accepts a user ID
# and returns their profile with posts and followers
Code language: PHP (php)

Press Enter, and Copilot writes the entire endpoint:

@app.get("/users/{user_id}/profile")
async def get_user_profile(user_id: int):
    user = await get_user(user_id)
    posts = await get_user_posts(user_id)
    followers = await get_user_followers(user_id)
    return {
        "user": user,
        "posts": posts,
        "followers": followers
    }
Code language: JavaScript (javascript)

I use this technique constantly for scaffolding code quickly.

Provide Examples

If you’re doing something repetitive, show Copilot one example:

// Convert user data to API format
const user1 = { id: users[0].user_id, name: users[0].full_name };
const user2 = // Copilot completes this following the pattern
Code language: JavaScript (javascript)

Copilot will suggest:

const user2 = { id: users[1].user_id, name: users[1].full_name };
Code language: JavaScript (javascript)

Copilot learns from code that’s currently visible. If you’re writing tests, keep the function you’re testing in an open editor tab. Copilot will generate tests that match the actual implementation.


Step 5: Using GitHub Copilot Chat

Copilot Chat is a separate feature (requires additional extension) but incredibly useful:

Opening Copilot Chat

VS Code:
– Click the chat icon in the sidebar, or
– Press Cmd+Shift+I (Mac) or Ctrl+Shift+I (Windows/Linux)

JetBrains:
– Tools → GitHub Copilot → Open Chat
– Or use the toolbar icon

What You Can Do with Chat

Explain code:

Select code → Right-click → Copilot → Explain This

I use this constantly when reading unfamiliar codebases.

Generate tests:

Select functionAsk: "Write unit tests for this function"
Code language: JavaScript (javascript)

Copilot Chat generates comprehensive tests based on the function’s logic.

Fix bugs:

Select buggy code → Ask: "This code has a bug where [describe issue]. Fix it."
Code language: JavaScript (javascript)

Refactor:

Select code → Ask: "Refactor this to use async/await instead of promises"
Code language: JavaScript (javascript)

Advanced Chat Features

Use @workspace to reference your codebase:

@workspace Where is user authentication handled?
Code language: CSS (css)

Use @terminal to debug errors:

@terminal Why am I getting this error: [paste error]
Code language: CSS (css)

Use #file to reference specific files:

#file:utils.js Explain how the debounce function works
Code language: CSS (css)

Step 6: Essential Keyboard Shortcuts

Memorise these for maximum productivity:

Core Copilot Shortcuts (VS Code)

ActionMacWindows/Linux
Accept suggestionTabTab
Reject suggestionEscEsc
Next suggestionOption+]Alt+]
Previous suggestionOption+[Alt+[
Open Copilot ChatCmd+Shift+ICtrl+Shift+I
Trigger inline suggestionOption+\Alt+\

Editor Shortcuts (helpful with Copilot)

ActionMacWindows/Linux
Select next occurrenceCmd+DCtrl+D
Select all occurrencesCmd+Shift+LCtrl+Shift+L
Move line up/downOption+↑/↓Alt+↑/↓
Copy line up/downShift+Option+↑/↓Shift+Alt+↑/↓
Multi-cursorOption+ClickAlt+Click

My workflow: I often accept a Copilot suggestion with Tab, then immediately use Cmd+D to select similar code and modify all instances at once.


Step 7: Advanced Techniques

Once you’re comfortable with the basics, these techniques will level up your Copilot usage:

Technique 1: Iterative Refinement

Don’t expect perfect code on the first suggestion. I often:
1. Accept initial suggestion (even if not perfect)
2. Modify the parts I don’t like
3. Use Copilot again to fill in the modified version
4. Repeat until it’s right

This is faster than trying to craft the perfect prompt.

Technique 2: Use Copilot for Boilerplate

Copilot excels at repetitive code. I use it for:
– CRUD operations
– API endpoints
– Test cases
– Database models
– Config files

Example: Writing Express routes:

// GET all users
app.get('/users', async (req, res) => {
  // Copilot writes the rest
});

// GET user by ID
app.get('/users/:id', async (req, res) => {
  // Copilot follows the pattern from the first route
});
Code language: JavaScript (javascript)

Technique 3: Comment-Driven Development

I’ve adopted a workflow where I write comments first, let Copilot implement them, then review and refine:

# Step 1: Validate input
# Step 2: Check if user exists in database
# Step 3: Hash password
# Step 4: Create user record
# Step 5: Send welcome email
# Step 6: Return user object

def create_user(email, password, name):
    # Copilot implements each step as I press Enter after each comment
Code language: PHP (php)

Technique 4: Language Translation

Copilot is surprisingly good at translating code between languages:

# Python function
def fibonacci(n):
    if n <= 1:
        return n
    return fibonacci(n-1) + fibonacci(n-2)

# JavaScript equivalent:
// Copilot suggests the JS version if you start typing the comment
Code language: PHP (php)

Step 8: Common Pitfalls to Avoid

Mistake 1: Accepting Everything Blindly

The problem: Copilot sometimes suggests code with bugs, security issues, or poor practices.

The solution: Always review suggestions. I accept about 60% of suggestions as-is, modify 30%, and reject 10%. Never merge Copilot code without testing.

Mistake 2: Not Providing Enough Context

The problem: Vague code gets vague suggestions.

The solution: Write descriptive names, add comments, and keep related code visible. The more context you give Copilot, the better it performs.

Mistake 3: Using It for Everything

The problem: Copilot isn’t good at complex business logic, architectural decisions, or novel algorithms.

The solution: Use Copilot for:
– Boilerplate and repetitive code
– Standard patterns you’ve seen before
– Refactoring and reformatting
– Tests and documentation

Don’t use it for:
– Core business logic (write this yourself)
– Security-critical code (review very carefully)
– Performance-sensitive algorithms
– Anything you don’t understand

Mistake 4: Ignoring the Chat Feature

The problem: Many users don’t even know Copilot Chat exists.

The solution: Use Chat for:
– Explaining unfamiliar code
– Generating tests
– Debugging errors
– Getting suggestions for refactoring

It’s incredibly useful and underutilised.


Real-World Workflow Example

Here’s how I actually use Copilot during a typical coding session:

Task: Add password reset functionality to a web app

Step 1: Create the route (with comments)

// POST /auth/reset-password
// Accepts email, generates reset token, sends email
router.post('/reset-password', async (req, res) => {
Code language: JavaScript (javascript)

Press Enter. Copilot suggests the implementation. I accept it.

Step 2: Generate tests (using Chat)
Select the function → Copilot Chat → “Write Jest tests for this function”

Copilot generates 10 test cases. I review them, keep 8, and modify 2.

Step 3: Implement email template (with examples)
I show Copilot one example email template. It generates the password reset template following the same pattern.

Step 4: Error handling (using Cmd+K inline)
Select the function → Ask: “Add comprehensive error handling”

Copilot adds try-catch blocks and input validation.

Step 5: Documentation (using comments)

/**
 * Initiates password reset process
 * Copilot completes the JSDoc based on the function signature
 */
Code language: JSON / JSON with Comments (json)

Total time: 15 minutes for a feature that used to take 45 minutes.


Measuring Your Productivity Gains

After two months of using Copilot, track these metrics:

Acceptance rate: Aim for 50-70%. If it’s lower, you might not be providing enough context. If it’s higher, you might not be reviewing carefully enough.

Lines written vs. lines accepted: I write about 40% of my code manually and accept 60% from Copilot. Your ratio will vary based on what you’re building.

Time saved: Track a specific task before and after using Copilot. Most developers see 30-50% time savings on routine coding tasks.


Customising Copilot Settings

Accessing Settings (VS Code)

Cmd+, (Mac) or Ctrl+, (Windows/Linux) → Search “Copilot”

Important Settings

GitHub > Copilot > Enable
– Default: On
– Keep it enabled (obviously)

GitHub > Copilot > Editor: Enable Auto Completions
– Default: On
– Turn off if you find suggestions too distracting

GitHub > Copilot > Inlineed Suggestions
– Default: On
– Shows gray inline suggestions as you type

GitHub > Copilot > Enable for [Language]
– Default: All enabled
– Disable for languages you don’t want suggestions (rare)


Pro Tips from 2 Years of Daily Use

Tip 1: Train Your Brain to Pause

I’ve learned to pause half a second after typing a function name or opening brace. This gives Copilot time to suggest, and I accept probably 70% of those suggestions. It’s a tiny pause that saves huge time.

Tip 2: Use Copilot for Learning

When exploring a new library, I write:

// Example of using [library] to [do something]
Code language: JSON / JSON with Comments (json)

Copilot often suggests working examples from the library’s documentation. It’s like having instant documentation with code samples.

Tip 3: Create a Snippets File

I keep a patterns.md file with common patterns I use:

# Common Patterns

## Express API Endpoint
...

## React useEffect with cleanup
...
Code language: PHP (php)

When I start writing similar code, Copilot sees this file (if it’s open) and suggests matching patterns.

Tip 4: Review Generated Code Immediately

Don’t accept suggestions and move on. I’ve learned to:
1. Accept the suggestion
2. Read through it immediately
3. Test the critical parts
4. Commit only after testing

This prevents bugs from accumulating.

Tip 5: Use Copilot for Refactoring

Select old code → Copilot Chat → “Refactor this to be more modern/readable/performant”

Copilot is excellent at suggesting better patterns for code that works but could be cleaner.


When Copilot Struggles

Copilot isn’t perfect. Here’s where it commonly falls short:

Complex business logic: If your logic is unique to your business, Copilot won’t have training data for it. Write this yourself.

Novel algorithms: Copilot suggests common algorithms well (sorting, searching), but struggles with novel approaches.

Security-critical code: Authentication, authorisation, cryptography—review very carefully. Copilot can suggest insecure patterns.

Performance optimisation: Copilot writes correct code, not necessarily fast code. Profile and optimise yourself.

Edge cases: Copilot is trained on average use cases. Unusual edge cases need your attention.


Troubleshooting Common Issues

“Copilot isn’t showing suggestions”

Check:
1. Is Copilot enabled? (Look for the Copilot icon in the status bar)
2. Are you signed in to GitHub?
3. Is your subscription active?
4. Try restarting your IDE
5. Check if auto-completions are enabled in settings

“Suggestions are terrible”

Try:
1. Write more descriptive code (names, comments)
2. Open related files (gives more context)
3. Use comments to guide Copilot
4. Check if you’re using a supported language
5. Try cycling through alternatives with Option+]

“Copilot is slow”

Solutions:
1. Check your internet connection (Copilot requires online access)
2. Disable other extensions that might conflict
3. Make sure you’re not on a slow network or VPN
4. Try clearing cache (in Copilot settings)


My Final Recommendations

Start simple. Master the basic Tab/Esc workflow before exploring Chat and advanced features.

Give it two weeks. The first few days feel awkward. By day 10, it clicks. By day 14, you won’t want to code without it.

Pay for a subscription. The $10/month is the best productivity investment I’ve made. The time saved pays for itself in the first week.

Learn the shortcuts. Print the shortcuts list and keep it visible for your first week. Muscle memory develops fast.

Don’t trust blindly. Review all suggestions, especially for authentication, database queries, and API endpoints.

Use it for boring tasks. Copilot shines at boilerplate, repetitive code, and tests. It’s less useful for complex problem-solving.

After two years of daily use, Copilot has fundamentally changed how I code. I’m faster, I write more tests, and honestly, I enjoy coding more when AI handles the tedious parts.

Give it a month. If you’re not significantly more productive by then, I’d be genuinely surprised.


Frequently Asked Questions

Is GitHub Copilot worth $10/month?

Yes, for professional developers. If you code more than 5 hours per week, the time savings easily justify the cost. The productivity boost pays for itself on the first day. For hobbyists who code occasionally, the free 30-day trial is a good test.

Does Copilot work with all programming languages?

Copilot supports all major languages: JavaScript, Python, TypeScript, Java, C++, C#, PHP, Ruby, Go, Rust, and many more. It works best with popular languages (more training data), but is functional with less common ones too.

Can I use Copilot offline?

No. Copilot requires an internet connection to work since the AI runs on GitHub’s servers. However, your IDE itself works offline—you just won’t get suggestions until you’re back online.

Will Copilot make me a worse programmer?

Not if you use it correctly. Think of it like a calculator—it handles tedious work so you can focus on problem-solving. The key is to review and understand the code it suggests, not just blindly accept everything. Use it to speed up implementation, not to avoid learning.

Has my code been sent to GitHub?

Yes, code snippets are sent to GitHub’s servers for AI processing. GitHub states they don’t train on your private code (as of 2023), but check their current privacy policy if you have concerns. For highly sensitive code, consider alternatives like Tabnine with on-premise deployment.

Can I use Copilot on multiple computers?

Yes. Your subscription allows Copilot on any computer where you’re signed in to GitHub. Install the extension, sign in, and it works immediately. No limits on the number of devices.

How does Copilot compare to Cursor AI?

Both are excellent. Copilot has wider IDE support and costs less ($10 vs $20/month). Cursor has better multi-file editing and deeper codebase understanding, but only works in VS Code. For VS Code power users, Cursor is worth considering. For teams using multiple IDEs, Copilot makes more sense.

For a detailed comparison, read my Cursor vs GitHub Copilot article.

Can I use Copilot with Cursor or other AI assistants?

Technically, yes, but it’s confusing and the suggestions conflict. Pick one AI assistant and master it. Don’t run multiple at once.



Leave a Reply

Your email address will not be published. Required fields are marked *