看板 Linux 關於我們 聯絡資訊
我從有從github 抓了一包程式 , 發現 .git 太大 我想把保留最新的20筆 git commit 資料 請問要怎麼做才可以只保留最新20筆 抱歉我講一下我推到bitbucket 步驟 1. git clone https://github.com/xxxx/xxxx.git --depth 20 2. git remote add backup ssh://[email protected]/nameID/backup.git 3. git push -u backup master push 之後就出現下面訊息 ! [remote rejected]master -> master (shallow up not allowed) 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 175.181.154.191 ※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1504373313.A.BA5.html
Bencrie: git clone --depth 20 09/03 01:48
yshihyu: 這方法我測試過確實可以!但是我遇到我想把這包程式 09/03 10:19
yshihyu: 裡面的20筆commit 資料推到另外一個 repo 會失敗... 09/03 10:20
yshihyu: 錯誤訊息印象中是提到沒有是git log 不完整 09/03 10:21
Bencrie: 那你還是 pull unswallow 整個拉下來吧 09/03 13:03
Bencrie: 沒人知道你那 20 commits 樹枝是怎麼長的 09/03 13:04
yshihyu: ! [remote rejected]master -> master (shallow update 09/03 17:33
yshihyu: not allowed) 09/03 17:33
yshihyu: git fetch --unshallow origin <-- 網路上說這樣解決 09/03 17:35
yshihyu: 可是我這樣做看起來又把所有 commit 都pull 下來 09/03 17:35
danny8376: 就是要全pull下來 你沒完整tree怎知道你要push到哪 09/04 00:56
yshihyu: 那有辦法針對最新20筆 commit 重建tree 嘛? 09/04 11:22
Vett: 我有時間研究這個我會直接把整個tree拉下來 09/04 16:15
Bencrie: 原 po 也沒說是怎麼推的。merge/rebase 還是 cherry-pick 09/04 17:37
※ 編輯: yshihyu (175.181.254.216), 09/05/2017 00:55:44 ※ 編輯: yshihyu (175.181.254.216), 09/05/2017 00:56:22
Bencrie: 你 backup 那個也 checkout 成 local branch 再 merge 09/05 02:05
Bencrie: 不然就土法煉鋼 git format-patch -20 & git am XD 09/05 02:05
soem: 試了一下,似乎可以用commit-tree合併重建21個commit以前, 09/07 01:38
soem: 然後用cherry-pick -m 1拉剩下的20個commit 09/07 01:38