我有一个git回购装置,有四个分支:
目前,我正在开发angular-routing,并尝试使用简单的git push来推动origin/angular-routing,但我注意到,我得到了以下错误:
! [rejected] johndev -> johndev (non-fast-forward)
我明白错误意味着什么,这很好,但我不明白为什么它一开始就试图推到那里。我的所有分支都被跟踪到相同的远程分支,这似乎是正确设置的。运行git remote show origin给我提供了以下内容:
Remote branches:
angular-routing tracked
dev tracked
johndev tracked
master tracked
Local branches configured for 'git pull':
angular-routing merges with remote angular-routing
dev merges with remote dev
johndev merges with remote johndev
master merges with remote master
Local refs configured for 'git push':
angular-routing pushes to angular-routing (up to date)
dev pushes to dev (up to date)
johndev pushes to johndev (local out of date)
master pushes to master (up to date)据我所知,这是正确的设置,所以我的git push on angular-routing没有理由试图推到johndev,但它确实是。
我在这里做错什么了?
发布于 2013-04-11 04:53:20
这是因为push.default的设置是matching,这是默认的。这意味着,当您在没有指定推送的情况下执行push时,git将尝试推送目标上已经存在的所有分支。
听起来,您可能希望将该设置更改为upstream,这将导致它默认只将当前分支推送到被配置为其上游分支的远程分支。这可以通过以下方式来完成:
git config --global push.default upstreamhttps://stackoverflow.com/questions/15940452
复制相似问题