What does git pull --rebase --ff-only do?
I saw a link on the command line that recommended git pull --rebase --ff-only
. I thought git would reject this, but it doesn't.
What does the combination --rebase
with mean --ff-only
?
Edit: I know perfectly well what everyone is doing.
[Edit, Dec 4, 2016: As of Git 2.6, it is git pull
no longer a script, so it is no longer easy to see what it does and the technical details below do not apply. But --ff-only
still only useful on merge, not on reboot.]
git pull
The script (you can view it yourself, for example less $(git --exec-path)/pull
) is currently allocating --ff-only
to a named variable $ff_only
, which is subsequently completely ignored if it completes the rebase:
case "$rebase" in
true)
eval="git-rebase $diffstat $strategy_args $merge_args $rebase_args $verbosity"
eval="$eval $gpg_sign_args"
eval="$eval --onto $merge_head ${oldremoteref:-$merge_head}"
;;
*)
eval="git-merge $diffstat $no_commit $verify_signatures $edit $squash $no_ff $ff_only"
eval="$eval $log_arg $strategy_args $merge_args $verbosity $progress"
eval="$eval $gpg_sign_args"
eval="$eval FETCH_HEAD"
;;
esac
eval "exec $eval"
In the end, this means that your parameter is being --ff-only
ignored.
It is possible that Git may reject these as incompatible in the future, so it is probably wiser to leave explicit --ff-only
when using explicit --rebase
.
Seems to --ff-only
be ignored when used --rebase
.