2

I have this:

* [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

How do I get rid of these two?

[e524891] (refs/stash) On (no branch): Checkout 

[cf4235c] index on (no branch): 22c8c38 Before implementing blueprints
martin's
  • 3,853
  • 6
  • 32
  • 58
  • So you don't need those changes? – zerkms Jul 06 '14 at 04:44
  • No, it was a complete mess. Nothing worked. Don't need any of that, wills start a new branch and start over. So, I'd like the tree to be clean. – martin's Jul 06 '14 at 04:50
  • Well, according to the tree - they don't belong to any branch. Just leave it as-is and GC will drop them one day. – zerkms Jul 06 '14 at 04:53
  • Those two references are from running `git stash`. To drop the stash without attempting to apply it anywhere, use `git stash drop`. Be sure you really mean this! – torek Jul 06 '14 at 07:01
  • Well, what's interesting is that I've never run `git stash`. I'll try that and see what happens. thanks. – martin's Jul 07 '14 at 14:49

1 Answers1

1

If those commits are not references by any branch, one simple trick is to clone your repo.

The new clone should get a clean history: master commits only.

As zerkms comments, you can run git gc, but I prefer keeping the first repo as it is (in case I need to find some lost data back), and work with a new clone.

By having to run a git gc --prune=now, you might drop more than you intended.

You see other cleaning techniques in "How to remove unreferenced blobs from my git repo".

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250