Skip to content

Instantly share code, notes, and snippets.

View oldwombat's full-sized avatar
🎯
Focusing

oldwombat

🎯
Focusing
View GitHub Profile
@oldwombat
oldwombat / git-batch-push.sh
Created April 24, 2025 06:34 — forked from spenserhale/git-batch-push.sh
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