0

company just pushed a big release, and since we have a little down time, i'd like to clean up my git repo so that it's cleaner for the next release.

I've read this S.O. question/answers and found it pretty helpful. however, i find that there are some things missing, and i'd like to compile a full list of things to clean up. here's what i plan on doing:

  1. drop all unnecessary stashes
  2. delete remote branches that are merged into master from github
  3. go through github and remove all unmerged remote branches that are not needed
  4. run git remote prune origin
  5. run git gc
  6. clean up fsck: Listing and deleting Git commits that are under no branch (dangling?)

what else am i missing? or is there a better process for doing the 5 steps above? basically, i'd like to have a clean stash, clean list of local branches, clean list of remote branches...etc. and only see the things that are relevant.

Community
  • 1
  • 1
David T.
  • 18,561
  • 18
  • 61
  • 115
  • Why wouldn't you delete your clone and make a new one? – bmargulies May 08 '14 at 23:11
  • 1
    There's no way to answer this. What is an "unneeded stash"? What is an "unneeded branch"? – meager May 08 '14 at 23:14
  • @bmargulies that's not a bad idea, but i have like 3 or 4 local/remote branches and 2 stashes that i'd like to keep around or am currently working on. – David T. May 08 '14 at 23:14
  • @meagar sorry if i was unclear - i'm not asking you to know which stashes i find unnecessary or necessary. i know how to determine that myself. an "unneeded stash" is a stash that is outdated or something that is no longer relevant. and what i was asking is if what i've listed is an exhaustive list of things to do to "clean up your work flow repository" – David T. May 08 '14 at 23:16
  • @bmargulies i just realized.... the repository is quite big... and i DEFINITELY do not want to re-clone it – David T. May 08 '14 at 23:43
  • @bmargulies Then just clone your local to a second directory and selectively copy branches. You don't have to copy anything across the network. – meager May 08 '14 at 23:45
  • @meagar - i'm assuming you meant to reply to me instead of bmargulies with that last comment. but could you please elaborate on how to perform this magical "clone your local repo without cloning any branches over" ? as far as i'm aware, cloning of any sort needs to copy over the `.git` folder, which is where all the local branches are already stored. i.e. i just did a local git clone and the same 200 branches are still there – David T. May 09 '14 at 00:10
  • @DavidT. That isn't true. Cloning does not copy all the branches, and it doesn't "copy over the .git folder". It makes a new .git folder, and copies *some* of the data from source repository to the new repository. You could test this yourself very easily, you'll find that none of your 200 branches are copied, only the [default branch](http://feeding.cloud.geek.nz/posts/setting-default-git-branch-in-bare/). – meager May 09 '14 at 02:27
  • @meagar oh interesting. i must have somehow been on the wrong folder earlier. i just tried it again and it seems to work. would you like to post your written up solution so i can upvote/accept it? – David T. May 09 '14 at 03:59

0 Answers0