nerdexam
Microsoft

AZ-400 · Question #613

You have a GitHub repository named repo1. You commit a change to repo1. You need to update the commit message. The solution must ensure that the version number remains the same. Which command should…

The correct answer is B. git commit --amend. To update the most recent commit message in a Git repository, use the command git commit -- amend to open your editor, change the message, and save it; if the commit has already been pushed, you'll need to force push with git push --force-with-lease origin <branch-name to…

Submitted by jakub_pl· Mar 6, 2026Design and implement source control

Question

You have a GitHub repository named repo1. You commit a change to repo1. You need to update the commit message. The solution must ensure that the version number remains the same. Which command should you run?

Options

  • Agit commit --patch
  • Bgit commit --amend
  • Cgit status --renames
  • Dgit restore --patch

How the community answered

(33 responses)
  • A
    15% (5)
  • B
    76% (25)
  • C
    6% (2)
  • D
    3% (1)

Explanation

To update the most recent commit message in a Git repository, use the command git commit -- amend to open your editor, change the message, and save it; if the commit has already been pushed, you'll need to force push with git push --force-with-lease origin <branch-name to update the remote repository with the new commit, which replaces the old one and generates a new https://docs.github.com/articles/changing-a-commit-message

Topics

#git amend#commit message#version control#git commands

Community Discussion

No community discussion yet for this question.

Full AZ-400 Practice