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 y
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 update
Question
Options
- Agit commit --patch
- Bgit commit --amend
- Cgit status --renames
- Dgit restore --patch
How the community answered
(33 responses)- A15% (5)
- B76% (25)
- C6% (2)
- D3% (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
Community Discussion
No community discussion yet for this question.