Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git pull即使在没有本地更改的情况下也会创建合并提交_Git - Fatal编程技术网

git pull即使在没有本地更改的情况下也会创建合并提交

git pull即使在没有本地更改的情况下也会创建合并提交,git,Git,我在Linux系统和mac中使用git。在我的Linux机器中,当我没有本地提交,而我只是从源代码处进行git pull时,它只是转发到主线中的最新提交。但是,当我在mac中执行相同操作时,无论是否有本地提交,它都会创建合并提交。例如: alias gln='git log --graph --pretty=format:'\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'

我在Linux系统和mac中使用git。在我的Linux机器中,当我没有本地提交,而我只是从源代码处进行git pull时,它只是转发到主线中的最新提交。但是,当我在mac中执行相同操作时,无论是否有本地提交,它都会创建合并提交。例如:

alias gln='git log --graph --pretty=format:'\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit --date=relative -n'
alias gln='git log--graph--pretty=格式:'\''%Cred%h%Creset-%C(黄色)%d%Creset%s%Cgreen(%cr)%C(粗体蓝色)%Creset'\''--abbrev commit--date=relative-n'
原始状态(在Linux和Mac中)

gln 2

* 6b05c11 - (HEAD -> mainline, origin/mainline, origin/HEAD) Original HEAD commit message (1 year, 4 months ago) <User1>
* f8cf2ee - Very old commit message (1 year, 8 months ago) <User1>
gln2
*6b05c11-(HEAD->mainline,origin/mainline,origin/HEAD)原始HEAD提交消息(1年,4个月前)
*f8cf2ee-非常旧的提交消息(1年,8个月前)
Linux中的Git pull(仅向前,无合并提交)

gpl
谷氨酰胺4
*ef1d887-(原点/主线,原点/前端)远程提交消息2(9周前)
*190df9c-远程提交消息1(9周前)
*6b05c11-原始头提交消息(1年,4个月前)
*f8cf2ee-非常旧的提交消息(1年,8个月前)
Git拉入Mac,它拉入并创建合并提交

gpl
gln 4

* ef1d887 - (origin/mainline, origin/HEAD) Remote commit message 2 (9 weeks ago) <User2>
* 190df9c - Remote commit message 1 (9 weeks ago) <User2>
* 6b05c11 - Original HEAD commit message (1 year, 4 months ago) <User1>
* f8cf2ee - Very old commit message (1 year, 8 months ago) <User1>
gpl
gln 5

* 254b0c7 - (HEAD -> mainline) Merge branch 'mainline' of ssh:......../MyPackage into mainline (7 seconds ago) <Myself>
|\  
| * ef1d887 - (origin/mainline, origin/HEAD) Remote commit message 2 (9 weeks ago) <User2>
| * 190df9c - Remote commit message 1 (9 weeks ago) <User2>
|/  
* 6b05c11 - Original HEAD commit message (1 year, 4 months ago) <User1>
* f8cf2ee - Very old commit message (1 year, 8 months ago) <User1>
gpl
谷氨酰胺5
*254b0c7-(HEAD->mainline)将ssh的分支“mainline”合并到mainline中:…../MyPackage(7秒前)
|\  
|*ef1d887-(源站/主线,源站/前端)远程提交消息2(9周前)
|*190df9c-远程提交消息1(9周前)
|/  
*6b05c11-原始头提交消息(1年,4个月前)
*f8cf2ee-非常旧的提交消息(1年,8个月前)
现在,每次拉拽后,我都必须在Mac上执行“git rebase-I”,以摆脱合并提交(它只显示一条noop消息并立即进行重新设置)


[问题]我是否可以更改任何配置,使我的mac git行为与我的linux git行为相似?

由于&drRobertz的评论,我发现了问题并得到了修复

不久前,我在Mac.gitconfig中添加了以下几行(不知道为什么)。这就是问题的根源

[branch "mainline"]
    mergeoptions = --no-ff

删除它后,我的git Pull可以在不添加合并提交的情况下工作(当我没有本地更改时)。

gpl的别名是什么?您的配置中是否有
--无ff
合并.ff
?对合并提交重定基址不一定像您认为的那样工作。您确定您的本地分支可以在Mac(和其他机器)上快速转发吗?我从未真正看到过这一点,已经使用Git很多年了