Skip to content

Instantly share code, notes, and snippets.

@crazyyy
Last active June 26, 2021 20:33
Show Gist options
  • Save crazyyy/e9c8d4c37eae8be21159 to your computer and use it in GitHub Desktop.
Save crazyyy/e9c8d4c37eae8be21159 to your computer and use it in GitHub Desktop.
#git || favorite scripts

GIT

Clean big files

Removes large or troublesome blobs like git-filter-branch does, but faster. And written in Scala

cd git-repo
# https://rtyley.github.io/bfg-repo-cleaner/
wget https://repo1.maven.org/maven2/com/madgag/bfg/1.14.0/bfg-1.14.0.jar
java -jar bfg-1.14.0.jar --strip-blobs-bigger-than 50M

Chechout Main branch of repo

git -C 'D:\apps\buckets\enk' checkout main

Child Folders cd git and clean

ECHO OFF
set MYDIR=d:\Works\Verstka\
for /F %%x in ('dir /B/D %MYDIR%') do (
  Pushd %%x
  Echo Current Folder %%x
  echo ADDREMOVE
  git add .
  hg addremove
  echo COMMIT
  hg commit -m "close and archive project"
  git commit -m "close and archive project"
  echo PUSH
  hg push
  git push
  echo CLEAN
  git repack -a -d --depth=250 --window=250
  rmdir node_modules
  Popd )
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment