Git rebase loses history, then why rebase?

后端 未结 5 1144
一整个雨季
一整个雨季 2020-12-12 23:54

I\'ve been looking into rebasing with Git over the past couple days. Most of the arguments for rebasing say that it cleans up the history and makes it more linear. If you do

5条回答
  •  有刺的猬
    2020-12-13 00:26

    If you make a mistake on a public repository and no one has forked/merged/pulled from it yet, you can save face and confusion:

    git reset --hard [SHAnumber]
    
    git rebase -f master
    
    git push -f origin HEAD:master
    

    To empty the trash:

    git gc
    

提交回复
热议问题