简体   繁体   English

git分支的rebase-push周期

[英]Rebase-push cycles for git branches

I'm currently using a github repository with a single branch, based of a master branch of another repository. 我目前正在使用一个GitHub存储库,该存储库具有一个分支,该分支基于另一个存储库的主分支。 The github branch is a backup of my work, and definitely not meant for pulling, and as such I'm comfortable with rewriting its history when rebasing from the master repository. github分支是我工作的备份,并且绝对不是要拉的,因此从主存储库重新部署时,我很愿意重写其历史记录。

My problem is that I want a clean history, and if histories diverge I can't do that. 我的问题是我想要干净的历史记录,如果历史记录不一致,我将无法做到这一点。 This happens if I do a push ( initial work ) + rebase - the second push is rejected. 如果我进行推送(初始工作)+重新设置,则会发生这种情况-第二次推送被拒绝。

I have tried to delete the branch and then push, but this has the nasty side effect of doing a drop-create of the repo, which is slow. 我试图删除分支,然后再推送,但是这样做有一个令人讨厌的副作用,即创建存储库的拖放创建,这很慢。

How should I approach this problem? 我应该如何解决这个问题?

git-push可以接受选项-f--force来告诉它强制推送以将远程引用(分支)更新为本地值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM