Git and GitHub · Part 3 · GitHub and remote repositories
Issues, labels and Projects
Where work is written down
A bug mentioned in a chat is forgotten by Friday. An issue is a numbered page in the repository for one piece of work: a bug, a feature, a question. It has a discussion, an owner and a status, and links to the code that solves it. Pull requests say how something changed; issues say why.
Writing a good issue
Click the Issues tab, then New issue. A bug report someone can act on without asking questions:
## Steps to reproduce
1. Add two items to the cart
2. Remove one
3. Look at the total
## Expected
The total shows the price of one item.
## Actual
The total still shows both items.
## Environment
Chrome 131, macOS, production siteThe title says what's wrong, not “Cart broken”. A feature request says what's needed and why, not only the solution.
Organizing issues
| Tool | What it's for | Example |
|---|---|---|
| Labels | The kind of work, or its priority | bug, enhancement, good first issue |
| Assignees | Who is doing it | jknithin36 |
| Milestones | A group with a due date | v1.2.0, Sprint 14 |
| Projects | A board for planning across issues | Todo → In progress → Done |
Every new repository comes with a set of labels, such as bug, documentation, enhancement, good first issue and help wanted. Edit them under Issues, then Labels.
Linking issues and pull requests
Writing #12 in any comment, commit message or pull request links to issue 12. A closing keyword goes further:
Fixes #12When that pull request is merged into the default branch, issue 12 closes by itself. close, closes, fix, fixes, resolve and resolves all work, and so do their past tenses. Each issue needs its own keyword: Fixes #12, fixes #15.
Issue templates
Templates make every bug report ask for the same details. They are files in .github/ISSUE_TEMPLATE/:
---
name: Bug report
about: Something isn't working
labels: bug
---
## Steps to reproduce
## Expected
## ActualAfter it's pushed, New issue offers it as a choice, with the bug label already added. A .github/pull_request_template.md file does the same for every new pull request's description.
Projects
A Project is a planning board that holds issues and pull requests, even from several repositories. Create one from the repository's Projects tab. It has three views of the same items:
- Board: columns like Todo, In progress and Done. Dragging a card changes its status.
- Table: a spreadsheet with custom fields, such as priority or size.
- Roadmap: items on a timeline, by date or iteration.
Built-in workflows move cards automatically, for example to Done when the issue closes, so a merged pull request with Fixes #12 updates the board with no clicks.
Quick reference
| Task | Command |
|---|---|
| Create an issue | gh issue create --title "…" --label bug |
| List open issues | gh issue list |
| List your issues | gh issue list --assignee @me |
| View an issue | gh issue view 12 |
| Close an issue | gh issue close 12 |
| Close one from a pull request | Fixes #12 |