Skip to content

Instantly share code, notes, and snippets.

@ksomemo
Created November 2, 2013 19:14
Show Gist options
  • Save ksomemo/7282412 to your computer and use it in GitHub Desktop.
Save ksomemo/7282412 to your computer and use it in GitHub Desktop.
REPO_DIR=git-pack-gc
LINE_NUM=100000 #000
FILE_NAME=numbers.txt
GIT_OBJECTS_DIR='.git/objects'
echo "mkdir and git init"
mkdir ${REPO_DIR}
cd ${REPO_DIR}
git init
echo ""
echo "Create ${LINE_NUM} lines file."
seq 1 ${LINE_NUM} > ${FILE_NAME}
echo "working tree size."
ls -lh
echo ""
echo "find git objects."
find ${GIT_OBJECTS_DIR}
echo ""
echo "git add ."
git add .
echo ""
echo "find git objects after git add command."
find ${GIT_OBJECTS_DIR}
echo ""
echo ".git/objects size."
du -sh ${GIT_OBJECTS_DIR}
echo ""
echo "git commit"
git commit -m "Create ${LINE_NUM} lines file."
echo ""
echo "find git objects."
find ${GIT_OBJECTS_DIR}
echo ""
echo "add one line to ${FILE_NAME} and git add."
echo `expr ${LINE_NUM} + 1` >> ${FILE_NAME}
git add .
echo ""
echo "find git objects."
find ${GIT_OBJECTS_DIR}
echo ""
echo ".git/objects size."
du -sh ${GIT_OBJECTS_DIR}
echo ""
echo "git commit."
git commit -m "Add 1 line."
echo ""
echo "find git objects."
find ${GIT_OBJECTS_DIR}
echo ""
echo ".git/objects size."
du -sh ${GIT_OBJECTS_DIR}
echo ""
echo "git gc"
git gc
echo ""
echo ".git/objects size."
du -sh ${GIT_OBJECTS_DIR}
echo ""
echo "find git objects."
find ${GIT_OBJECTS_DIR}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment