Skip to content

Instantly share code, notes, and snippets.

View Vlad55432's full-sized avatar

Vlad Vlad55432

View GitHub Profile
@spenserhale
spenserhale / git-batch-push.sh
Last active May 6, 2025 06:06
When your repo exceeds upload limit (GitHub 2GB), you can push in batches so you can store up to total size limit. (100GB) (Warning uses force push, ideally should be used for setting up new remote, once)
# Adjust the following variables as necessary
REMOTE=origin
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BATCH_SIZE=250
# check if the branch exists on the remote
if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then
# if so, only push the commits that are not on the remote already
range=$REMOTE/$BRANCH..HEAD
else