Skip to content

Instantly share code, notes, and snippets.

@minlaxz
Last active October 26, 2021 05:29
Show Gist options
  • Save minlaxz/006102cc14f1519cd0284ffbedf2db1c to your computer and use it in GitHub Desktop.
Save minlaxz/006102cc14f1519cd0284ffbedf2db1c to your computer and use it in GitHub Desktop.

Revisions

  1. minlaxz revised this gist Oct 26, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions clean-up-repo-size.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    Check git repo size : `git count-objects -v`

    First checkout to the commit, which you want to make as the initial commit. Then run the following commands :

    ```
  2. minlaxz created this gist Oct 26, 2021.
    14 changes: 14 additions & 0 deletions clean-up-repo-size.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    First checkout to the commit, which you want to make as the initial commit. Then run the following commands :

    ```
    git checkout --orphan temp_branch
    git add -A
    git commit -am "Initial commit message"
    git branch -D main
    git branch -m main
    git push -f origin main
    git gc — aggressive — prune=all # remove the old files
    ```

    The above commands will force fully push the current source code to `main` branch as the first command.
    Note : You should delete all other branches and tags, because it may still contain the old history.