300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > 【Git】push 分支报错 error: failed to push some refs to...

【Git】push 分支报错 error: failed to push some refs to...

时间:2024-06-09 06:48:28

相关推荐

【Git】push 分支报错 error: failed to push some refs to...

文章目录

报错消息解决方法

报错消息

示例图: 示例代码:

➜ fisher git:(test) git push origin testTo :wxg-bigdata/fisher.git! [rejected]test -> test (fetch first)error: failed to push some refs to ':wxg-bigdata/fisher.git'hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first integrate the remote changeshint: (e.g., 'git pull ...') before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.

翻译:

: wxg-bigdata / fisher.git!(拒绝 ] 测试→首先测试(获取)Error: failed to push some refs to ':wxg-bigdata/fish .git'提示:更新被拒绝,因为远程包含您所做的工作提示:没有本地。这通常是由另一个存储库推送引起的提示:相同的ref。你可能想要首先集成远程更改提示:(例如,'git pull…')然后再推。提示:请参阅'git push—help'中的'Note about fast-forward '获取详细信息。

解决方法

分析:这是由于你push推送分支前,未进行pull拉取最新代码,导致版本不一致

解决:回退到合并之前的代码,pull拉取最新代码,再push推送分支

注意:这种解决方法适用于2个分支之间的merge操作,比如test分支回退版本,那test上合并的代码会丢失,等你test分支能成功pull后,需要重新merge开发分支上的代码合并到test上。所以记得保留这个版本的代码再回退到上一个版本,等pull成功,再重新合并代码

查看最近3次提交的历史版本

➜ fisher git:(test) git log -3# 查看最近3次提交的历史版本commit da20b931f4e04a61f0f9b4e4726a2e907e566fc9 (HEAD -> test)Merge: 33df706e 6018c237Author: v_isiliu <v_isiliu@>Date: Wed Jan 19 09:58:40 +0800Merge branch 'feture/tapd#870810123' into testcommit 6018c237278f5265e78314049d6642e493ebdb5e (feture/tapd#870810123)Author: v_isiliu <v_isiliu@>Date: Wed Jan 19 09:57:50 +0800feat: 发布版本'feture/tapd#870810123'commit 33df706e780d10af6435bda1fee85430604eebfcMerge: 1d06cd1f 7589979dAuthor: v_isiliu <v_isiliu@>Date: Tue Jan 18 16:11:21 +0800Merge branch 'feature/date#0118' into test

回退到上一个版本

➜ fisher git:(test) git reset --hard 33df706e780d10af6435bda1fee85430604eebfcHEAD is now at 33df706e Merge branch 'feature/date#0118' into test

再进行pull更新分支

➜ fisher git:(test) git pull origin test

重新合并当前分支

➜ fisher git:(test) git merge feture/tapd#870810123

最后再 push 上去

➜ fisher git:(test) git push origin test

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。