Skip to content

Instantly share code, notes, and snippets.

@jhoblitt
Last active November 2, 2015 21:30
Show Gist options
  • Save jhoblitt/8356077e7e3456596a5c to your computer and use it in GitHub Desktop.
Save jhoblitt/8356077e7e3456596a5c to your computer and use it in GitHub Desktop.
Experimental conversion of ci_hsc repo to use lfs for *.fits files
# converting an existing repo to use "lfs"
#
# note that a .gitattributes file for lfs needs to be added to any commit in
# which large files are present in the tree
wget https://github.com/rtyley/bfg-repo-cleaner/releases/download/git-lfs-alpha/bfg-1.12.4-SNAPSHOT-git-lfs-7242876.jar
git clone [email protected]:/home/price/LSST/ci_hsc
cd ci_hsc
java -jar ../bfg-1.12.4-SNAPSHOT-git-lfs-7242876.jar --convert-to-git-lfs -fi *.fits --no-blob-protection --private
git reset --hard
# stolen from https://gist.github.com/larsxschneider/a31fb77c7e9a9c9b81da
for FILE in .git/lfs/objects/*; do
OBJ_ID=$(basename "$FILE")
OBJ_DIR=".git/lfs/objects/${OBJ_ID:0:2}/${OBJ_ID:2:2}"
mkdir -p "$OBJ_DIR"
mv "$FILE" "$OBJ_DIR/$OBJ_ID"
done
git filter-branch --tree-filter "echo '*.fits filter=lfs diff=lfs merge=lfs -text' > .gitattributes" HEAD
git reflog expire --expire=now --all && git gc --prune=now
git remote rename origin upstream
git remote add origin [email protected]:lsst/ci_hsc.git
git push -u origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment