重新绑定以及通过重新绑定推动提交的意思是什么 [英] Rebasing and what does one mean by rebasing pushed commits

查看:168
本文介绍了重新绑定以及通过重新绑定推动提交的意思是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

人们经常说,你不应该改变你已经推动的提交。这可能是什么意思? ProGit 有一个很好的解释



您的问题的具体答案可以在标题为重新定义的危险一节中找到。来自该部分的引用:


当你重新编写东西时,你是
放弃现有的提交和
创建新的类似但
不同的那些。如果你在某处推送提交
,并且其他人将它们拉到
并基础工作,然后你
用git rebase
重写那些提交并再次推送它们,你的
合作者将不得不重新合并
他们的工作,而当您尝试将他们的工作转回
时,它们会变得杂乱




更新:

根据您的评论,听起来您的Git工作流程存在困难。以下是一些可能有所帮助的参考资料:




It is often said that, you should not rebase commits that you have already pushed. What could be meaning of that?

解决方案

The ProGit book has a good explanation.

The specific answer to your question can be found in the section titled "The Perils of Rebasing". A quote from that section:

When you rebase stuff, you’re abandoning existing commits and creating new ones that are similar but different. If you push commits somewhere and others pull them down and base work on them, and then you rewrite those commits with git rebase and push them up again, your collaborators will have to re-merge their work and things will get messy when you try to pull their work back into yours.

Update:
Based on your comment below, it sounds like your are having difficulty with your Git workflow. Here are some references that may help:

这篇关于重新绑定以及通过重新绑定推动提交的意思是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆