我有这个:
* [f037cb3] (HEAD, master, branch-01) More cleanup
* [9d3d167] Trying to cleanup
| * [e524891] (refs/stash) On (no branch): Checkout 75d5bbe7e935eef26b88af304838c04abb60c629 at 7/5/14 12:31 A| |\
|/ /
| * [cf4235c] index on (no branch): 22c8c38 Before implementing blueprints
|/
* [22c8c38] Before implementing blueprints
* [3cff07c] Switched to Bootstrap
* [a4d5973] Added basic unit test
* [a14a6ab] Added 404 and 500 error pages
* [869bf35] Added user_id to stored session data
* [08dcf3b] Updated forms
* [9fc43b7] Added user registration
* [2e41a3c] Added database file to git
* [4eccb17] Renamed database file
* [e9820fc] Added user registration
* [02a2448] Most of the transition to SQLAlchemy is done. Commit just before adding forms.py
* [dcc0f56] Before switching to Flask-SQLAlchemy
我如何摆脱这两个?
[e524891] (refs/stash) On (no branch): Checkout
[cf4235c] index on (no branch): 22c8c38 Before implementing blueprints
答案 0 :(得分:1)
如果这些提交不是任何分支的引用,一个简单的技巧就是克隆你的repo。
新克隆应该获得干净的历史记录:master
仅提交。
作为zerkms comments,您可以运行git gc
,但我更喜欢保留第一个回购原样(如果我需要找回一些丢失的数据),并使用一个新的克隆。
必须运行git gc --prune=now
,您可能会超出预期。
您可以在" How to remove unreferenced blobs from my git repo"。
中看到其他清洁技巧