如果在推送后重新绑定,会发生什么? [英] What happens if I rebase after pushing?

查看:112
本文介绍了如果在推送后重新绑定,会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总是听到这是可怕的事情,我永远不应该做的事情。例如,以下是SourceTree中的拉对话框的样子:





所以我很好奇,会发生什么,如果我推动了变化,然后重新推动并再次推动它们,会有多糟?如果我以这种方式破解存储库,如何解决存储库问题?解析方案

没有什么会发生,但是你的下一步将是不接受。



除非你会强行推送。
这也不会破坏远程仓库,所以它也没有那么糟糕。



当有更多人使用这个仓库时,情况变糟。
重写历史记录可能会导致其他人将一些混乱,从而引发远程的新变化。特别是如果他们对git没有很好的了解。
根据本地存储库的状态,拉取重写的远程分支可能会发生不同的事情。

所以如果有人会使用特性X和你改变了他基于他的改变的代码,他可能会至少不满生气,取决于他的工作已经过时了多少。

I always hear that it's something scary and something I should never do. For example, here's how the pull dialog looks like in SourceTree:

So I'm curious, what would happen and how bad would it be if I had pushed changes, then rebased and pushed them again? And how to fix the repository if I'd break it this way?

解决方案

Nothing would happen, but your next push would be not accepted.

Unless you would force push. This would not break remote repository also, so it is also not that bad.

Things go bad when you have more people using this repo. Rewriting history can cause a bit of chaos for others who will pull new changes from remote. Especially if they do not have good knowledge of git. There can be different things that might happen for person pulling rewritten remote branch depending on state of their local repository.

So if someone would work on feature X and you changed the code on which he based his changes, he might get at least upset to downright angry depending on how much of his work you made obsolete.

这篇关于如果在推送后重新绑定,会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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