Version Control with GitHub and Gemini CLI
Explore how to manage version control seamlessly using Gemini CLI. Learn to initialize Git repositories, create .gitignore files, stage and commit changes with clear messages, and push code to GitHub. This lesson helps you automate your workflow using natural language commands, integrating professional version control into your development process.
We’ve now built, debugged, and refactored a working Flask application. The next step is to save our work professionally using version control. Instead of running Git commands manually, we’ll ask Gemini to handle the workflow: initializing a repository, staging our files, and generating a clear, conventional commit message based on our changes.
Initializing the repository
Our project currently exists only on our local filesystem. The first step is to place it under version control by creating a new Git repository. The Gemini CLI can interact directly with Git through its shell command execution feature, allowing us to manage our repository using natural language. We will start with a simple, high-level command to Gemini.
Prompt: Initialize a new Git repository in this project directory.
The agent correctly interpreted our high-level goal and executed the git init command to place our project under version control. Our directory is now a fully functional Git repository, establishing the foundation needed to track and save our work.
Checking the project status
With the repository initialized, the next step is to check which files Git is tracking. This quick check confirms that everything is set up correctly and shows us the current state of the project. Let’s ask Gemini to report the repository status.
Prompt: Check the status of our Git repository.
The agent ...