Skip to content

Instantly share code, notes, and snippets.

@jhoblitt
Last active November 2, 2015 21:30
Show Gist options
  • Select an option

  • Save jhoblitt/8356077e7e3456596a5c to your computer and use it in GitHub Desktop.

Select an option

Save jhoblitt/8356077e7e3456596a5c to your computer and use it in GitHub Desktop.

Revisions

  1. Joshua Hoblitt revised this gist Sep 1, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion convert-lfs.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # converting an existing repo to use "fs"
    # 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
  2. Joshua Hoblitt created this gist Sep 1, 2015.
    24 changes: 24 additions & 0 deletions convert-lfs.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    # converting an existing repo to use "fs"
    #
    # 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