Introduction
If you've been assigned to work on a project that you're not familiar with—or you've found an interesting open source project that you want to contribute to—you'll need some understanding of the codebase before you can start making changes. This guide will show you how to use GitHub Copilot 채팅 to explore a codebase and quickly learn about the project.
Working with Copilot 채팅
Throughout this guide, we'll work on GitHub.com, using Copilot 채팅 in assistive mode, which displays a Copilot 채팅 panel over the bottom right corner of your current page on GitHub.com.
You can expand the Copilot 채팅 panel, to give more space for displaying Copilot's responses, by clicking and dragging the edges of the panel.
Using the predefined prompts
Copilot 채팅 comes with a set of predefined prompts that can help you get started with exploring a codebase. You can use the prompts by clicking a button in the chat panel. The buttons are displayed when you start a new conversation with Copilot 채팅. The selection of prompts varies depending on the currently displayed page on GitHub.com.
-
Open the repository you want to explore on GitHub.com.
-
Click the Code tab to display the main page of the repository.
-
Shift+C를 눌러 보조 모드에서 Copilot 채팅을 엽니다.
-
Click the Tell me about this repository button in the chat panel.
팁
If this button is not displayed, make sure you are on the main page of the repository and click the plus sign () at the top right of the Copilot panel to start a new conversation.
A predefined prompt is submitted to Copilot and the response is displayed in the chat panel.
-
Optionally, after reading the response, click the plus sign () at the top right of the Copilot panel to start a new conversation, then click How to get started with this repository.
Example prompts
The following prompts are examples of the kind of questions you can ask Copilot to help you find out about a codebase.
General questions
-
Based on the code in this repository, give me an overview of the architecture of the codebase. Provide evidence.
-
Which languages are used in this repo? Show the percentages for each language.
-
What are the core algorithms implemented in this repo?
-
What design patterns are used in this repository? Give a brief explanation of each pattern that you find, and an example of code from this repository that uses the pattern, with a link to the file.
Specific questions
Whether these questions are useful will depend on the codebase you're exploring.
-
How do I build this project?
-
Where is authentication handled in this codebase?
-
Analyze the code in this repository and tell me about the entry points for this application.
-
Describe the data flow in this application.
-
Analyze the code in this repository and tell me what application-level security mechanisms are employed. Provide references.
Understanding the files in a directory
Use Copilot to help you understand the purpose of the files in a directory, or individual files.
To find out about the files in a directory:
- Navigate to the directory on GitHub.com.
- Shift+C를 눌러 보조 모드에서 Copilot 채팅을 엽니다.
- Ask Copilot:
Explain the files in this directory
.
To find out about a specific file:
- Open the file on GitHub.com.
- Shift+C를 눌러 보조 모드에서 Copilot 채팅을 엽니다.
- For a small file, ask Copilot:
Explain this file
. - For a large file, ask:
Explain what this file does. Start with an overview of the purpose of the file. Then, in appropriately headed sections, go through each part of the file and explain what it does in detail.
Understanding specific lines of code
Use Copilot to help you understand specific lines of code in a file.
To find out about a specific line of code:
- On GitHub, navigate to a repository and open a file.
- Select the lines by clicking the line number for the first line you want to select, holding down Shift and clicking the line number for the last line you want to select.
- To ask your own question about the selected lines, click the Copilot icon () to the right of your selection. This displays the GitHub Copilot 채팅 panel with the selected lines indicated as the context of your question.
- To ask a predefined question, click the downward-pointing button beside the Copilot icon, then choose one of the options.
- If you clicked the Copilot icon, type a question in the prompt box at the bottom of the chat panel and press Enter.
Understanding a specific file or symbol
Use Copilot to help you understand the purpose of a specific file or symbol in the codebase. A symbol is a named entity in the code, such as a function, class, or variable.
-
Navigate to a repository on GitHub.
-
페이지 오른쪽 위에서 아이콘 옆에 있는 을 클릭한 다음, Assistive를 클릭하여 Copilot 채팅 패널을 엽니다.
-
In the prompt box, click Attach, then click Files, folders, and symbols.
-
Search for and select one or more files, folders, or symbols.
-
In the prompt box, type a question and press Enter.
Copilot replies in the chat panel.
팁
리포지토리 컨텍스트에서 이와 같은 자연어 질문에 답할 수 있는 Copilot의 기능은 리포지토리의 의미 체계 코드 검색 인덱스가 최신일 때 최적화됩니다. 자세한 내용은 Indexing repositories for Copilot Chat을(를) 참조하세요.
Finding out about commits
One good way to familiarize yourself with a project is to look at the recent work that's been happening. You can do this by browsing the recent commits.
-
GitHub에서 리포지토리의 기본 페이지로 이동합니다.
-
리포지토리의 기본 페이지에서 파일 목록 위에 있는 커밋을 클릭합니다.
-
Click a commit message to display a diff view for that commit.
-
In the Copilot 채팅 panel, enter:
What does this commit do?
. -
If necessary, you can follow up by entering:
Explain in more detail
.
Using the Insights tab
In addition to using Copilot to help you become familiar with a project, you can also use the Insights tab on GitHub.com. This gives you a high-level overview of the repository.
For more information, see Pulse를 사용하여 리포지토리 활동 요약 보기 and 프로젝트의 기여자 보기.