刘华佼的全栈学习记录

队友先push成功,我后push被拒绝怎么办?

| Comments

问题:

发现推送出现问题,因为队友先推送,我后推送,就被拒绝了。报错如下:

To github.com:dumpling001/jdstore
 ! [rejected]        develop -> develop (fetch first)
error: failed to push some refs to 'git@github.com:dumpling001/jdstore'
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.

对策:

看ihower老师讲解的协作视频,发现解决办法是:

git pull 先拉下最新进度
git push 再把自己做的推送上去

再让队友git pull下最新进度。

还好不是碰到 ! [rejected] master -> master (non-fast forward) 的失败信息,这种需要:

先git pull,
再手动解决冲突,
然后git push,
再让队友git pull。

参考资料

https://fullstack.xinshengdaxue.com/posts/1236




  • 如果想看我们的作品,请点击思想便当
  • 如果觉得我们的作品还不错,欢迎给我们作品投上你宝贵的一票哟!

Comments

comments powered by Disqus