A developer has modified several tracked files in a local Git repository. They now want to commit these changes with the message "Update user authentication module" in a single step, without individually staging the files. Which of the following commands will accomplish this?
git commit --track -m "Update user authentication module"
git commit -a -m "Update user authentication module"
git commit --amend -m "Update user authentication module"
The correct command is git commit -a -m "Update user authentication module". The -a flag stages all modified or deleted files that are already tracked by Git, and the -m flag provides the commit message inline. This combination allows the developer to stage and commit in one command. git commit -m alone would fail because the changes were not staged first. git commit --amend is used to modify the most recent commit, not to create a new one for unstaged changes. git commit --track is incorrect because --track is not a valid option for the git commit command.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the `-a` flag do in `git commit -a`?
Open an interactive chat with Bash
Why is `git commit --amend` not the correct choice here?
Open an interactive chat with Bash
What is the purpose of the `-m` flag in Git commit commands?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Automation, Orchestration, and Scripting
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access