git pull --no-commit
This command is useful when you want to combine upstream changes into your local branch but pause before recording the merge commit, giving you an opportunity to inspect or tweak the merged files.
It first fetches updates from the remote and then merges the specified branch into your current HEAD using --no-commit
, which applies the changes to the working tree and staging area but stops short of creating the merge commit.
You can then resolve conflicts, make edits, or review the combined diff before running git commit
to finalize the merge. This mirrors doing git fetch
followed by git merge --no-commit
manually.
Variations include using git pull --ff-only
to allow only fast-forward merges or adding --no-ff
to always create a merge commit even when a fast-forward is possible. You can also split it into two steps with git fetch
and git merge --no-commit
. For rebase-centered workflows try git pull --rebase
or git pull --rebase=interactive
.
Commands like git stash
and git diff
can complement this by letting you stash local changes before pulling or inspect differences prior to committing.