Pushing to github after a shallow clone

前端 未结 5 916
春和景丽
春和景丽 2020-12-02 23:56

I had a massive git repo because of a huge number of commits, so following advice here I created a shallow clone. I\'ve made changes to this new local repo, and now I want t

5条回答
  •  时光取名叫无心
    2020-12-03 00:15

    Option 1) If you still have the original repo, just fetch from it before pushing:

    git fetch --unshallow
    

    Option 2) BEWARE! this is only recommended for new repos, as this WILL result in loss of history, and also is highly prone to conflicts!!

    If you've already removed the repository where you fetched from, you need to discard all history with.

     git filter-branch -- --all
     git push
    

    git filter-branch : Lets you rewrite Git revision history

    -- : separates filter-branch options from revision options

    --all : to rewrite all branches and tags

提交回复
热议问题