Your project follows a linear history workflow. While on the main branch with a clean working tree, you want to integrate the finished branch feature/refactor as a single commit. You run:
$ git merge --squash feature/refactor
Which statement correctly describes the repository's state immediately after this command and the one step still required before you can push the result?
Git has already created and checked out a new merge commit containing all changes; you can push main immediately.
The command rewrites feature/refactor into one commit by rebasing it onto main; you now need to force-push feature/refactor so teammates can fast-forward.
The changes from feature/refactor are staged in the index but no commit exists; you must run git commit to create the single squashed commit before pushing.
main has been fast-forwarded to the tip of feature/refactor and marked as merged; no further action is necessary.
The --squash option applies all changes from the specified branch to the working tree and stages them in the index, but it deliberately does not create a commit, move HEAD, or record a merge commit. As a result, you must execute a normal git commit to produce the single squashed commit on main and then push it. The other options are wrong because Git has not yet created any commit (so nothing is ready to push), it does not rewrite the source branch, and the operation is not a fast-forward.
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 --squash option do in Git?
Open an interactive chat with Bash
Why is `git commit` necessary after using git merge --squash?
Open an interactive chat with Bash
How is a squash merge different from a fast-forward merge?
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