作者:
yshihyu (yshihyu)
2017-09-03 01:28:29我從有從github 抓了一包程式 , 發現 .git 太大
我想把保留最新的20筆 git commit 資料
請問要怎麼做才可以只保留最新20筆
抱歉我講一下我推到bitbucket 步驟
1. git clone https://github.com/xxxx/xxxx.git
作者:
yshihyu (yshihyu)
2017-09-03 10:19:00這方法我測試過確實可以!但是我遇到我想把這包程式裡面的20筆commit 資料推到另外一個 repo 會失敗...錯誤訊息印象中是提到沒有是git log 不完整
那你還是 pull unswallow 整個拉下來吧沒人知道你那 20 commits 樹枝是怎麼長的
作者:
yshihyu (yshihyu)
2017-09-03 17:33:00! [remote rejected]master -> master (shallow updatenot allowed)git fetch --unshallow origin <-- 網路上說這樣解決可是我這樣做看起來又把所有 commit 都pull 下來
作者:
danny8376 (釣到一隻猴子@_@)
2017-09-04 00:56:00就是要全pull下來 你沒完整tree怎知道你要push到哪
作者:
yshihyu (yshihyu)
2017-09-04 11:22:00那有辦法針對最新20筆 commit 重建tree 嘛?
作者:
Vett (Vett)
2017-09-04 16:15:00我有時間研究這個我會直接把整個tree拉下來
原 po 也沒說是怎麼推的。merge/rebase 還是 cherry-pick你 backup 那個也 checkout 成 local branch 再 merge不然就土法煉鋼 git format-patch -20 & git am XD
作者:
soem (æµæ°´)
2017-09-07 01:38:00試了一下,似乎可以用commit-tree合併重建21個commit以前,然後用cherry-pick -m 1拉剩下的20個commit