I saw a command line reference which recommended git pull --rebase --ff-only
. I thought git would reject that, but it doesn’t.
What does the combination of --rebase
with --ff-only
mean?
Edit: I perfectly know what each alone does.
I saw a command line reference which recommended git pull --rebase --ff-only
. I thought git would reject that, but it doesn’t.
What does the combination of --rebase
with --ff-only
mean?
Edit: I perfectly know what each alone does.
[Edit, 4 Dec 2016: as of Git version 2.6, git pull
is no longer a script, so it is no longer easy to see what it does and the technical details below no longer apply. But --ff-only
is still only useful when merging, not when rebasing.]
The git pull
script (you can view it yourself, e.g., less $(git --exec-path)/pull
) currently separates out --ff-only
into a variable named $ff_only
that it subsequently ignores entirely if it winds up doing a 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"
What this means in the end is that your --ff-only
option gets ignored.
It's possible that in the future, git might reject these as incompatible, so it's probably wiser to leave out an explicit --ff-only
when using an explicit --rebase
.