2014-11-06 56 views
1

我已經推出了一個功能分支github,我意識到我想要rebase爲了壓扁一些提交。我在我的本地分行運行git rebase fixup推後被拒絕

git rebase HEAD~5 

,並設置所有,但第一個和最後承諾「修正」。我保存並退出,rebase繼續保持良好狀態。當我嘗試推我得到

error: failed to push some refs to '[email protected]:username/repo.git' 
hint: Updates were rejected because the tip of your current branch is behind 
hint: its remote counterpart. Integrate the remote changes (e.g. 
hint: 'git pull ...') before pushing again. 

有沒有辦法做到這一點沒有推-f或是我唯一的追索?有沒有更好的方法來壓縮提交?

回答

3

唯一的辦法是用git push -f。您刪除的提交(通過用一個壓扁的代替)提交已經在遠程。如果沒有-f,則只能添加提交,而不能刪除/替換它們。

另一方面,如果沒有人編輯它,它應該不是一個問題。