如果在推送后重新绑定,会发生什么? [英] What happens if I rebase after pushing?
问题描述
所以我很好奇,会发生什么,如果我推动了变化,然后重新推动并再次推动它们,会有多糟?如果我以这种方式破解存储库,如何解决存储库问题?解析方案
没有什么会发生,但是你的下一步将是不接受。
除非你会强行推送。
这也不会破坏远程仓库,所以它也没有那么糟糕。
当有更多人使用这个仓库时,情况变糟。
重写历史记录可能会导致其他人将一些混乱,从而引发远程的新变化。特别是如果他们对git没有很好的了解。
根据本地存储库的状态,拉取重写的远程分支可能会发生不同的事情。
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屋!