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 
5
  • So you don't need those changes? Commented Jul 6, 2014 at 4: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. Commented Jul 6, 2014 at 4: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. Commented Jul 6, 2014 at 4: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! Commented Jul 6, 2014 at 7:01
  • Well, what's interesting is that I've never run git stash. I'll try that and see what happens. thanks. Commented Jul 7, 2014 at 14:49

1 Answer 1

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".

Sign up to request clarification or add additional context in comments.

3 Comments

... or one could run git gc (with --prune == today)
tbh I'm not sure today will work, never tried that. But if it will - I've learnt something new today :-)
Thanks, that's enough to shove me in the right direction.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.