skip to Main Content

I’m used to using git, and this is the first time I get this error that I don’t understand.

After a fresh clone on Linux

# git status
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working tree clean

Even if I know that all is updated :

# git pull
error: preserve: 'preserve' superseded by 'merges'
fatal: invalid value for 'pull.rebase': 'preserve'
# 

# git --version
git version 2.37.1
#

Why this ?

2

Answers


  1. Chosen as BEST ANSWER

    There was a /etc/gitconfig not linked to the git package, I can't know its origin I removed it

    [alias]
      sts = status -s
      st = status -sb
      cl = clone
      ci = commit
      ca = commit --amend
      filelog = log -u
      fl = log -u
    
      cp = cherry-pick
      co = checkout
      unstage = reset HEAD
      precommit = diff --cached --diff-algorithm=minimal -w
    
      pushf = push --force-with-lease
    
      br = branch
      bra = branch -ra
    
      #list commands
      tip = log -n 1 --abbrev-commit --decorate
      lol = log --graph --decorate --pretty=oneline --abbrev-commit
      lola = log --graph --decorate --pretty='format:%C(auto)%h %C(cyan)[%ar]%C(auto)%d %C(yellow)%ae %Creset%s' --abbrev-commit --all
      tig = log --graph --boundary --left-right --cherry-pick --decorate HEAD...FETCH_HEAD
      ll = log --pretty=format:"%C(yellow)%h%Cred%d\ %Creset%s%Cblue\ [%cn]" --decorate --numstat
    
      #list all aliases
      la = "!git config -l | grep alias | cut -c 7-"
      #list modified files in last commit
      dl = "!git ll -1"
    
      #diff last commit
      dlc = diff --cached HEAD^
      dr  = "!f() { git diff -w "$1"^.."$1"; }; f"
      diffr  = "!f() { git diff "$1"^.."$1"; }; f"
      dw = diff --word-diff
      dcw = diff --color-words
      dcwr = diff --color-word=.
    
      r = reset
      r1 = reset HEAD^
      r2 = reset HEAD^^
      rh = reset --hard
      rh1 = reset HEAD^ --hard
      rh2 = reset HEAD^^ --hard
      nevermind = !git reset --hard HEAD && git clean -d -f
    
      #stash
      sl = stash list
      stashes = stash list
      sa = stash apply
      ss = stash save
      sp = stash pop
    
      last = log -1 --stat
      lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %Cblue<%an>%Creset' --abbrev-commit --date=re
    lative --all
    
    [merge]
      tool = kdiff3
    
    [mergetool "kdiff3"]
      trustExitCode = False
    
    [diff]
      guitool = kdiff3
    
    [difftool "kdiff3"]
      trustExitCode = False
    
    [core]
      autocrlf = input
      trustctime = false
      editor = vim
      filemode = false
      eof = lf
    [push]
      default = upstream
    [pull]
      rebase = preserve
    
    [credential]
      helper = cache --timeout 36000
    

  2. Try git config --list --show-origin --show-scope

    In ubuntu 22.04 a newer version of git deprecated "pull.rebase=preserve"

    Git typically has config:

    • system level in /etc/gitconfig
    • global level in /home/<username>/.gitconfig
    • local level in .git/config of the repo you are in

    I suspect the repo you are in has the old settings so you can run:

    git config --local pull.rebase merges

    or if you see it in system or global modify the above command to the correct scope.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search