Quick Start with Gemini CLI
Step 1: Start Your First Session
Open a terminal in any project directory and launch Gemini CLI:
cd /path/to/your/project
geminiYou will see the Gemini CLI welcome screen, which shows session information, recent conversations, and the latest updates. Type /help to see available commands, or /resume to continue a previous conversation.
Your credentials come from the API information configured in your environment variables.
Step 2: Ask Your First Question
Let’s start by understanding your codebase. Try these commands:
> what does this project do?Gemini will analyze your files and provide a summary. You can also ask more specific questions:
> what technologies does this project use?> where is the main entry point?> explain the folder structureYou can also ask Gemini about its own capabilities:
> what can Gemini CLI do?> how do I use slash commands in Gemini CLI?> can Gemini CLI work with Docker?Gemini CLI reads your files as needed — you do not need to manually add context. Gemini also has access to its own documentation and can answer questions about its features and capabilities.
Step 3: Make Your First Code Change
Now let Gemini CLI do some actual coding. Try a simple task:
> add a hello world function to the main fileGemini CLI will:
- Find the right file
- Show you the suggested changes
- Ask for your approval
- Execute the edits
Gemini CLI always asks for permission before modifying files. You can approve individual changes, or enable “Accept all” mode for the session.
Step 4: Use Git with Gemini CLI
Gemini CLI makes Git operations conversational:
> what files have I changed?> commit my changes with a descriptive messageYou can also perform more complex Git operations:
> create a new branch called feature/quickstart> show me the last 5 commits> help me resolve merge conflictsStep 5: Fix a Bug or Add a Feature
Gemini excels at debugging and feature implementation.
Describe what you want in natural language:
> add input validation to the user registration formOr fix an existing issue:
> there's a bug where users can submit empty forms - fix itGemini CLI will:
- Locate the relevant code
- Understand the context
- Implement the solution
- Run tests if available
Step 6: Try Other Common Workflows
There are many ways to collaborate with Gemini:
Refactor code
> refactor the authentication module to use async/await instead of callbacksWrite tests
> write unit tests for the calculator functionsUpdate documentation
> update the README with installation instructionsCode review
> review my changes and suggest improvementsRemember: Gemini CLI is your AI pair programming partner. Interact with it like a helpful colleague — describe what you want to achieve, and it will help you get there.
Essential Commands
Here are the most important commands for everyday use:
| Command | What it does | Example |
|---|---|---|
gemini | Start interactive mode | gemini |
gemini "task" | Run a one-off task | gemini "fix the build error" |
gemini -p "query" | Run a one-off query then exit | gemini -p "explain this function" |
gemini -c | Continue the most recent session | gemini -c |
gemini -r | Resume a previous session | gemini -r |
gemini commit | Create a Git commit | gemini commit |
/clear | Clear conversation history | > /clear |
/help | Show available commands | > /help |
exit or Ctrl+C | Exit Gemini CLI | > exit |
Tips for Beginners
Be Specific with Requests
Instead of: “fix the bug”
Say: “fix the login bug where users see a blank screen after entering wrong credentials”
Use Step-by-Step Instructions
Break complex tasks into steps:
> 1. create a new database table for user profiles> 2. create an API endpoint to get and update user profiles> 3. build a webpage that allows users to see and edit their informationLet Gemini Explore First
Let Gemini understand your code before making changes:
> analyze the database schema> build a dashboard showing products that are most frequently returned by our UK customersUse Shortcuts to Save Time
- Use Tab for command completion
- Press ↑ to scroll through command history
- Type
/to see all slash commands
Getting Help
- Inside Gemini CLI: type
/helpor ask “how do I…”
Next Steps
Once you have mastered these basics, you can start exploring Gemini CLI’s applications in real-world development scenarios.