How to make Git pull use rebase by default for all my repositories?

git

Solution

There are now 3 different levels of configuration for default pull behaviour. From most general to most fine grained they are:

1. `pull.rebase`

Setting this to `true` means that `git pull` is always equivalent to `git pull --rebase` (unless `branch.<branchname>.rebase` is explicitly set to `false`). This can also be set per repository or globally.

2. `branch.autosetuprebase`

Setting this to `always` means that whenever a tracking branch is created, a configuration entry like the one below will be created for it. For finer grained control, this can also be set to `never`, `local` or `remote` and can be set per repository or globally. See `git config --help` for further details.

3. `branch.<branchname>.rebase`

Setting this to `true` means that that particular branch will always pull from its upstream via rebasing, unless `git pull --no-rebase` is used explicitly.

Conclusion

So while you can't change the default behaviour for all future clones of a repository, you can change the default for all of the current user's (existing and future) repositories via `git config --global pull.rebase true`.

Problem

Is there a way to setup the host Git repository such that any `git pull` done from its (local) clones uses `--rebase` by default? By searching on Stack Overflow, I learned about `branch.autosetuprebase`, but it needs to be configured per clone individually. My project flow is set up such that we `pull` the `develop` branch before `merge`ing a feature branch to it. This `pull` nearly always uses `--rebase`, so I am trying to figure out if this can be the default.

Original source