git gc --aggressive push to server?

前端 未结 3 1963
再見小時候
再見小時候 2020-12-05 13:10

It seems like git gc --aggressive really cleans up my repo, but when I do git push everything is already up-to-date. Is there a way to clean up the

相关标签:
3条回答
  • 2020-12-05 13:31

    I know that Github will run git gc periodically as the Github support mentions in this thread.

    I don't know if you can force it yourself though.
    I didn't see such a service in the Github hooks.

    0 讨论(0)
  • 2020-12-05 13:39

    I believe that pushing your changes will only add new commits (as necessary to reach the branches you are pushing); it will not delete them. This is corroborated by this github support page on deleting sensitive data:

    Be warned that force-pushing does not erase commits on the remote repository, it simply introduces new ones and moves the branch pointer to point to them. If you are worried about users accessing the bad commits directly via SHA1, you will have to delete the repository and recreate it.

    So if you can't wait for GitHub's periodic gc, then you have to recreate.

    0 讨论(0)
  • 2020-12-05 13:48

    You'll have to run the same command on the server side as well. Most people just set up a cron job or similar to do this sort of housekeeping periodically.

    0 讨论(0)
提交回复
热议问题