I think that Steve's advice is way to drastic.  It means you will lose
_all_ of your development history.

Why not just do 'git gc' (garbase collect)?  Then, as Steve said, you
may need to 'git push <heroku-repository> --force'

Because Heroku will only checkout the master branch, I use the
following refspec in my config file when pushing to Heroku:

[remote "heroku"]
        url = [email protected]:my-app.git
        push = +HEAD:refs/heads/master
[push]
        default = current

This means, push whatever branch I may be on to Heroku master.

The consequence of so many pushes to the master branch from other
branches is that Heroku's history of my project got muddles, so when I
tried pushed a new revision, things weren't loading, even though the
change was to a test file that is never run by Heroku.  I fixed it by
deleting and rebuilding my app on Heroku, which I know may be time
consuming if you have a lot of add-ons.  You may want to develop a
script if you have to do this more than once in a great while.

Of  course, don't depend on Heroku to keep your main repository.  Do
that on Github, or perhaps a shared-host where you have an account so
that it gets backed up daily.  That way, if disaster strikes, you
still have a good backup.

On Jun 11, 4:52 am, Steve Smith <[email protected]> wrote:
> Hey, If you really need to clean out the repo and start from a clean
> init (I personally think that its worth keeping just for the history)
> then you can do something along these lines (I haven't tried it so
> backup and double check before you do it).
>
> # find all the git files and remove them
> cd APP_DIR
> rm -rf `find . -name .git`
>
> #re init the repo
> git init
> git add .
>
> #check everything and commit
> git commit -m 'fresh repo after cleanup'
>
> # Then add heroku as a remote again
> git remote add [email protected]:APP_NAME.git heroku
>
> # Then force heroku to accept the new commit
> git push heroku master --force
>
> Like I said I haven't checked it so it might be worth making a copy of
> the app using a bundle or something and testing things first.
>
> Steve
>
> On Jun 8, 9:39 pm, Dan Z <[email protected]> wrote:
>
>
>
> > I've got several apps where I need to re-init or clean out the
> > repository (partly to reduce the bundle size). Heroku doesn't support
> > direct access to the machine.
>
> > Is there some way (e.g. a git command) I can accomplish this without
> > creating a new app and pushing my clean repository to it?
>
> > The problem with that is that I'd have to re-add and configure all my
> > addons, and it would require DNS changes, which are a pain and involve
> > some downtime.

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to