git pull : 错误: preserve: "preserve" 被 "merges" 取代 fatal: 'pull.rebase' 的值无效: 'preserve'



我习惯于使用git,这是我第一次遇到我不理解的错误。

在Linux 上进行新的克隆之后

# git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean

即使我知道一切都更新了:

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

为什么这样?

尝试git config --list --show-origin --show-scope

在ubuntu 22.04中,git的更新版本被弃用";pull.rebase=preserve";

Git通常有配置:

/etc/gitconfig中的
  • 系统级
  • /home/<username>/.gitconfig中的全局级别
  • 您所在回购的.git/config中的本地级别

我怀疑你所在的回购有旧的设置,所以你可以运行:

git config --local pull.rebase merges

或者,如果您在系统或全局中看到它,请将上述命令修改到正确的范围。

有一个/etc/gitconfig没有链接到git包,我不知道它的来源我删除了它

[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

相关内容

  • 没有找到相关文章

最新更新