Hello! Welcome to your fourth lesson in the "Collaboration with GitHub" module.
In our previous lesson, we conducted a full-cycle simulation of creating a pull request, performing a code review, addressing feedback, and merging the changes. You saw that a PR is a conversation about code. But this begs the question: how do we decide what work needs to be done in the first place? Where do these ideas for features or reports of bugs come from?
Today, we'll answer that question by exploring GitHub Issues. You will learn how to use Issues to track bugs, plan new features, and manage tasks within your projects. For a DevOps professional, mastering Issues is crucial for maintaining a clear, traceable, and centralized record of all work, from the initial idea to the final deployment.
1. What are GitHub Issues?
Think of GitHub Issues as a dedicated project management and discussion forum built right into your repository. They are the starting point for almost all work. While the name might suggest they are only for "issues" or bugs, they are used for a much wider range of purposes:
- Bug Reports: Detailing unexpected behavior.
- Feature Requests: Proposing new functionality.
- Tasks: Tracking a to-do list for a larger goal.
- Questions & Discussions: A place to ask for clarification or discuss ideas before writing any code.
In a DevOps context, this creates a transparent and traceable workflow. A feature can be proposed in an Issue, discussed by the team, implemented in a branch, reviewed via a Pull Request that references the original Issue, and finally deployed, with the entire history linked together.

2. The Anatomy of an Issue
Creating an issue is straightforward, but creating an effective one requires providing the right information. Let's look at the core components and the basic workflow.
The video below provides an excellent demonstration of creating, assigning, and labeling an issue.
Git and GitHub Tutorials #5 - Understanding GitHub Issues
This video from TheCodex will walk you through the fundamentals of creating and managing your first GitHub Issue. Pay close attention to the different metadata fields like 'Assignees' and 'Labels' and how they help organize work.
Watch from the beginning to 02:54. Focus on how to create a new issue, write a title and description using Markdown, assign it to a team member, and apply labels for categorization (e.g., 'enhancement').
As you saw, every issue has several key parts:
- Title: A concise summary of the task.
- Description: A detailed explanation. You can use Markdown to format text, add images, create lists, and more.
- Assignees: The person or people responsible for working on the issue.
- Labels: Tags used to categorize issues. Common default labels include
bug,enhancement,documentation, andgood first issue. Teams often create custom labels for priority (priority:high), status (status:in-progress), or team ownership (team:backend).
3. Best Practices: Writing Clear and Actionable Issues
An issue with the title "It's broken" and no description is not helpful. To work effectively, especially in a distributed team, issues must be clear, concise, and contain all the necessary information for someone to understand the task and start working on it.
Best Practices for Writing Effective GitHub Issues
Let's dive into the best practices for writing effective issues. This post from the GitHub community outlines the key elements that make an issue truly useful.
Read section '1. Key Elements of an Effective GitHub Issue'. Pay attention to the specific recommendations for bug reports, such as 'Steps to Reproduce', 'Expected Behavior' vs. 'Actual Behavior', and providing environment details.
To summarize the key best practices:
- For a Bug Report:
- Title: Start with "Bug:" followed by a clear summary.
- Steps to Reproduce: Provide a numbered list of the exact steps to trigger the bug.
- Expected vs. Actual Behavior: State what you thought would happen and what actually happened.
- Environment: Include relevant details like Operating System, Browser/Version, etc.
- Evidence: Add screenshots, error messages, or log files.
- For a Feature Request:
- Title: Start with "Feature:" or "Enhancement:".
- Problem Statement: Describe the problem this feature would solve ("As a user, I want to... so that I can...").
- Proposed Solution: Describe how you imagine the feature working.
Test your understanding!
You discover that when you log into your team's web application using Safari on your Mac, the main dashboard doesn't load, showing only a blank white screen. How would you formulate the title and initial description for a high-quality bug report issue?
Show answer
A good issue would look something like this:
Title: Bug: Dashboard fails to load on Safari, shows blank screen
Description:
Steps to Reproduce:
- Open Safari on macOS.
- Navigate to the login page.
- Enter valid credentials and click "Log In".
Expected Behavior:
The user should be redirected to the main dashboard, which should display all the relevant widgets and data.
Actual Behavior:
The user is redirected to a blank white screen. The dashboard content does not load. The browser console shows a TypeError.
Environment:
- OS: macOS Sonoma 14.1
- Browser: Safari 17.1
4. Linking Code to Issues: The Magic of Integration
The real power of GitHub Issues comes from their tight integration with code. You can link your commits and pull requests directly to the issues they address, creating a complete audit trail.
The same video we watched earlier demonstrates this powerful feature.
Git and GitHub Tutorials #5 - Understanding GitHub Issues
Now, let's see how to connect our code directly to the issues we're tracking. This part of the video shows two powerful techniques: referencing an issue and automatically closing it.
Watch from 03:13 to 05:30. Notice how typing # followed by the issue number in a commit message creates a link. Then, pay close attention to the use of the keyword fixes to automatically close the issue when the commit is merged.
There are two key takeaways here:
- Referencing an Issue: Simply include
#<issue-number>(e.g.,#42) in a commit message or pull request description. GitHub will automatically convert this into a link to the issue. - Auto-Closing an Issue: Use keywords like
closes,fixes, orresolvesbefore the issue number (e.g.,fixes #42). When a commit or PR with this message is merged into the repository's default branch (usuallymain), GitHub will automatically close the corresponding issue. This is an incredibly efficient workflow for DevOps.
5. Leveling Up: Issue Templates
To ensure everyone on the team follows the best practices we just discussed, you can create Issue Templates. These are pre-filled templates for different types of issues (like bugs or features) that prompt the author to provide specific information.
GitHub Issue Templates - GitHub Project Management Tutorial
Issue templates are a game-changer for maintaining consistency and quality. This video provides a clear walkthrough of how to set them up for your repository.
Watch the video from the beginning, focusing on these parts: The introduction explaining the benefit of templates (0:00 - 0:34). Setting up a Bug Report template (1:10 - 2:47). Setting up a Feature Request template (2:47 - 3:30). Seeing the final result when creating a new issue (6:31 - 7:45).
Setting up templates involves creating Markdown files in a special .github/ISSUE_TEMPLATE directory in your repository. This is a common DevOps task to help standardize project workflows.
6. Practical Exercise: Managing Work with Issues
Let's use the pr-practice repository from our last lesson to put this all into practice. If you deleted it, please create a new repository.
Step 1: Create a Bug Report Issue
- Navigate to your
pr-practicerepository on GitHub and click the "Issues" tab. - Click "New issue".
- For the Title, enter:
Bug: Project description is missing from README. - In the Description, write a proper bug report. Use the following structure:
**Steps to Reproduce:** 1. Clone the repository. 2. Open the `README.md` file. **Expected Behavior:** The README should contain a title and a brief description of the project's purpose. **Actual Behavior:** The README only contains a title. There is no project description. - On the right-hand side, under Labels, select the
buglabel. If it doesn't exist, create it. - Under Assignees, assign the issue to yourself.
- Click "Submit new issue". Note the issue number (it will likely be
#1).
Step 2: Create a Feature Request Issue
- Click "New issue" again.
- For the Title, enter:
Feature: Add a contribution guide. - In the Description, write:
To encourage others to contribute, we should add a `CONTRIBUTING.md` file that explains how to participate in the project. - Under Labels, select the
enhancementlabel. - Assign this issue to yourself as well.
- Click "Submit new issue".
Step 3: Fix the Bug and Link the Work
- On your local machine,
cdinto yourpr-practicedirectory. Make sure you are on themainbranch and have the latest changes (git pull origin main). - Create a new branch to fix the bug:
git checkout -b fix/readme-description. - Open
README.mdin an editor and add a description line. The file should look like this:# PR Practice Project This project is for practicing the GitHub pull request and code review workflow. - Stage and commit the change. This is the important part! Write a commit message that will auto-close the issue. Replace
#1with your actual bug report issue number.git add README.md git commit -m "docs: Add project description to README This commit adds the missing project description to the main README file, addressing the identified bug. Fixes #1" - Push your branch to GitHub:
git push origin fix/readme-description.
Step 4: Create and Merge the Pull Request
- Go to GitHub. You should see a prompt to create a pull request for your new branch. Click it.
- The title and description will be pre-filled from your commit message. Notice on the right sidebar under "Development," your PR is already linked to the issue!
- Click "Create pull request".
- Since this is a simple fix, you can immediately click "Merge pull request" and then "Confirm merge".
Step 5: Verify the Result
- Go back to the "Issues" tab.
- You should see that the bug report issue is now in the "Closed" section.
- Click on the closed issue. You will see a notification in the timeline stating that you closed this issue via the commit you just merged.
Conclusion
You have now learned to manage the entire lifecycle of a task in GitHub, from inception to completion. Issues provide the "what" and "why," while branches and pull requests provide the "how."
Key Takeaways:
- GitHub Issues are used to track bugs, features, and other tasks.
- A high-quality issue has a clear title, a detailed description (with steps to reproduce for bugs), and appropriate metadata like labels and assignees.
- You can reference an issue in a commit or PR with
#<issue-number>. - You can automatically close an issue by using keywords like
fixes,closes, orresolvesin your commit message when it's merged into the default branch. - Issue templates help enforce consistency and quality across your project.
In our next lesson, we will tie all of this together by looking at structured workflows for development. Now that we know how to track tasks (Issues) and manage code changes (PRs), we'll explore different branching strategies like GitFlow and GitHub Flow to organize how we build features and fix bugs in a systematic way.