Skip to content

Use `git pull --rebase` instead of `git rebase`

My git version 2.26.2 returns an error code 1 and doesn't rebase in a fast-forward scenario. I have to admit that I'm surprised by this myself. But git pull --rebase does what we want, so apparently that should be used instead? Or is this some local configuration issue?

When I run kdesrc-build without this patch I get:

        Updating sysadmin-repo-metadata using existing branch master
log_command(): Module sysadmin-repo-metadata, Command: git checkout master
# kdesrc-build running: 'git' 'checkout' 'master'
# from directory: /home/milian/projects/kf5/src/sysadmin/repo-metadata
Already on 'master'
Your branch is behind 'origin/master' by 105 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
log_command(): Module sysadmin-repo-metadata, Command: git rebase origin/master
# kdesrc-build running: 'git' 'rebase' 'origin/master'
# from directory: /home/milian/projects/kf5/src/sysadmin/repo-metadata
error: nothing to do
Logfile for sysadmin-repo-metadata is git-rebase.log
        Unable to update the source code for sysadmin-repo-metadata

Indeed, I can also easily reproduce this issue outside of kdesrc-build directly in my shell:

$ git --version
git version 2.26.2
$ cd /home/milian/projects/kf5/src/sysadmin/repo-metadata
$ git status
On branch master
Your branch is behind 'origin/master' by 105 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

nothing to commit, working tree clean
$ git rebase origin/master
error: nothing to do
$ echo $?
1

A git pull --rebase origin master fast-forwards my local checkout as intended. This is what this patch does now too, thereby fixing all the errors/warnings in kdesrc-build (and properly updating my local checkouts again).

Merge request reports