Hacker News new | ask | show | jobs
by gsylvie 3358 days ago
This has saved me:

    git config  --global pull.ff only
I can always override an individual pull invocation with either "git pull --rebase" or "git pull --no-ff", making it a conscious choice when a fast-forward pull is not possible.
2 comments

Oh wow, this must be a recent feature, I remember looking for a way to configure `--ff-only` by default a few years ago and it didn't seem possible. I ended up making a git alias of `git puff` which calls pull with the `--ff-only` flag.
Looks like it showed up with commit b814da891e, and has been around since Git v2.0.0.

The online docs mention it in Git v2.1.0: https://git-scm.com/docs/git-config/2.1.0

p.s. If you set this config, and a fast-forward pull is not possible, here is what git does:

    $ git pull
    fatal: Not possible to fast-forward, aborting.