我有一个回购建立在GitHub上,与Dev分支,这是我用克隆我的本地机器:分公司合并为自上混帐推
git clone https://github....
我然后切换到使用我的Dev分支:
git checkout -b Dev
然后我拉只是为了确保一切是最新的
git pull origin Dev
我现在在我的Dev分支,写一些代码和广告d使用文件:
git add filename
我然后提交使用:
git commit -m "message"
我然后按使用:
git push origin Dev
这工作都好。然后第二个用户出现并输入一些代码。与此同时,我正在处理单独的文件,但我们正在同一分支上工作。我像以前一样添加和提交。然而,当我尝试推,我收到以下内容:
To
https://github.com/ex/ex.git
! [rejected]
Dev -> Dev (fetch first) error: failed to push some refs to 'https://github.com/ex/ex.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 merge the remote changes (e.g., hint: 'git pull') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
我这样做,因为它说,并执行:
git pull origin Dev
然后我就可以像以前一样推,一切似乎都很好。然而,当我检查提交历史记录时,回到GitHub,我看到:
Merge branch 'Dev' of https://github.com/ex/ex into Dev
其中我刚刚添加的提交。为什么会发生这种合并?我怎样才能阻止这种情况发生?
'GIT中pull'基本上'GIT中取出; git merge' – knittl