引導式測驗 · 簡單 等級

如何用 AI 撰寫 Git 提交訊息測驗

檢查如何在分階段變更中落實 AI 提交訊息草稿、傳達意圖、準確報告測試以及驗證儲存庫約定。

問題 1 的 8

A developer wants AI to summarize only the files prepared for a commit. What should they inspect or provide?

預覽每個問題8 問題

當您參加測驗時,就會出現答案和解釋。

  1. A developer wants AI to summarize only the files prepared for a commit. What should they inspect or provide?
    • The entire repository without identifying staged changes
    • The staged diff showing changes prepared for the next commit
    • Only the current branch name
    • A screenshot of the code editor
  2. The diff shows a compatibility workaround, but not why it is needed. What should the commit body include?
    • Verified rationale supplied by the author
    • A guessed explanation from the model
    • A claim that all users requested it
    • Nothing except a second subject line
  3. Why should a generated message avoid claiming tests passed when only test files changed?
    • Test files can never be committed
    • Git commits automatically run every test
    • A message should always describe a successful test
    • The diff does not prove the tests were executed successfully
  4. Which format is described in Git’s commit documentation as a useful pattern?
    • A single paragraph with no title
    • A required JSON object in every repository
    • A short title, blank line, then a fuller description
    • A filename list without a summary
  5. A repository requires Conventional Commits. The AI suggests a feature type for a documentation-only correction. What should the author do?
    • Use the suggestion because AI knows the convention
    • Check the repository rule and correct the type to match the actual change
    • Remove the staged docs
    • Add a feature type to every commit
  6. The working tree contains an unrelated local edit. Why check the staged diff before drafting?
    • The message should describe the change that will actually be committed
    • Git includes every working-tree change in every commit automatically
    • The AI can decide which unrelated edits are safe to include
    • A commit message stages files by itself
  7. Who is responsible for the accuracy of an AI-drafted commit message?
    • The language model after the message is displayed
    • The Git server alone
    • The next person who reads the history
    • The author who reviews and records it
  8. A patch changes code and includes tests, but the team has not run them. What is a truthful message choice?
    • Say all tests passed to make the message complete
    • Claim the patch is risk-free
    • Describe the change and omit or accurately qualify any test claim
    • Use the test filenames as proof of success