【发布时间】:2018-08-16 22:40:54
【问题描述】:
我正在与另外三个合作者一起工作,我的情况是:
每次我尝试添加一个新的提交并且远程有一些变化(即使它是一个我没有在本地工作过的文件)时,我都会收到以下消息,迫使我创建与以下内容的合并默认消息:
error: failed to push some refs to 'https://work.git.beanstalkapp.com/app.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
只有在遥控器没有变化的情况下才能避免这种情况。
这会导致提交历史记录中出现许多看起来像 Merge branch 'master' of https://work.git.beanstalkapp.com/app 的提交,我想避免这种情况。
我发现了一个相关的question,对于某些使用git push -f origin master 的人来说,它正在工作,但使用--force 让我担心。我不想破坏项目。
我怎样才能做到这一点?
【问题讨论】:
-
是的,按照消息说的做,然后从远程拉取(或变基到)更改。
-
这就是我正在做的,但这会创建看起来像
Merge branch 'master' of https://work.git.beanstalkapp.com/app的提交,这是我想要避免的 -
如果您将工作重新建立在远程工作之上,则不会。
-
我更新了问题,以突出我想要避免的场景