Created
August 23, 2025 08:32
-
-
Save kha-dinh/6a6b6e9782fa4e373edeadddcd111ac6 to your computer and use it in GitHub Desktop.
Push very large repo with millions of commits (e.g., Linux) to github in steps. This overcome Github's 2GB limit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash ╭─────────── Line Numbers ────────────╮ | |
| BR=main | |
| mapfile -t COMMITS < <(git rev-list --reverse --first-parent "$BR") | |
| STEP=10000 | |
| for ((i = $STEP - 1; i < ${#COMMITS[@]}; i += STEP)); do | |
| │ git push origin "${COMMITS[$i]}:refs/heads/main" | |
| done | |
| # Final push to bring remote to tip | |
| git push origin "$BR:refs/heads/main" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment