Skip to main content

Copilot Chat 提示入门

了解使用 Copilot Chat 的方法概述。

可以向 Copilot Chat 询问有关项目的特定问题或常见软件问题。 还可以要求 Copilot Chat 编写代码、修复错误、编写测试和记录代码。

使用上面的选项卡选择使用 Copilot Chat 的环境。

某些示例提示要求你位于 GitHub 网站上的特定上下文中。 有关如何访问这些上下文的详细信息,请参阅在不同上下文中向 Copilot Chat 提问

询问常见软件问题

可以向 Copilot Chat 询问常见软件问题。 例如:

  • tell me about nodejs web server frameworks
  • how to create an express app
  • what is the best way to update an npm package

询问关于仓库的问题

可以向 Copilot Chat 询问有关仓库的问题。 例如:

  • what is the purpose of this repository?
  • When was the most recent release?
  • Where is rate limiting implemented in our API?
  • What was the last merged PR by USERNAME

询问有关特定文件或符号的问题

可以向 Copilot Chat 询问有关特定文件或符号的问题。 例如:

  • what sorting algorithm does this function use
  • how are these files related
  • what is the purpose of this function

询问有关知识库的问题

可以向 Copilot Chat 询问有关知识库的问题。 例如:

  • How do I deploy a new application?
  • What's the process for creating a new REST API?
  • What are our best practices for logging?

询问有关特定代码段的问题

可以向 Copilot Chat 询问有关特定代码段的问题。 可以询问有关整个文件或特定行的问题。 例如:

如果要询问关于整个文件的问题,则可以输入:

  • Explain this file.
  • How could I improve this code?
  • How can I test this script?

如果要询问特定行,则可以输入:

  • Explain the function at the selected lines.
  • How could I improve this class?
  • Add error handling to this code.
  • Write a unit test for this method.

询问有关 GitHub Advanced Security 警报的问题

可以向 Copilot Chat 询问组织仓库中来自 GitHub Advanced Security 功能的安全警报的相关问题(code scanning、secret scanning 和 Dependabot alerts)。 例如:

  • How would I fix this alert?
  • How many alerts do I have on this pull request?
  • Which line of code is this code scanning alert referencing?
  • What library is affected by this Dependabot alert?

向 Copilot Chat 询问拉取请求的问题

可以向 Copilot Chat 询问拉取请求的问题。 你的问题可以与拉取请求的各个元素相关,例如:

可以询问拉取请求中的更改摘要问题:

  • Summarize this PR for me.
  • Summarize the comments in this PR.
  • Summarize the changes in this PR.

可以询问拉取请求中特定文件的更改问题:

  • What's the purpose of this file?
  • Why has this module been included?

可以询问拉取请求中特定行的更改问题:

  • What is "actorData" in this line?
  • Explain this "do..end" block.

可以询问工作流失败的原因:

  • Tell me why this job failed
  • Suggest a fix for this error

向 Copilot Chat 询问有关特定议题或讨论的问题

可以向 Copilot Chat 询问有关特定议题或讨论的问题。 例如:

  • what is the purpose of this issue?

向 Copilot Chat 询问有关特定提交的问题

可以向 Copilot Chat 询问有关特定提交的问题。 例如:

  • what is the purpose of this commit?
  • what is the expected output of this commit?
  • what is the best way to test this commit?