What does git pull –rebase –ff-only do?

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?

  • How to reference remote repositories in a git alias?
  • svn and git versioning models difference
  • In Visual Studio Code How do I merge between two local branches?
  • keeping up with master from other branch
  • Using back-ticks in Python subprocess
  • Send pull request to GitHub
  • Edit: I perfectly know what each alone does.

  • npm install from git url missing some files
  • What is the best way to clone branches after cloning just trunk in git-svn?
  • Unique git url for github repo with multiple branches?
  • Why is indentation in empty lines bad?
  • Can't manage to load my private key with git extension
  • Get Deleted files list from Git Commits
  • 2 Solutions collect form web for “What does git pull –rebase –ff-only do?”

    [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.

    Seems --ff-only will be ignored when using --rebase.

    Git Baby is a git and github fan, let's start git clone.