#!/bin/bash set -e if [ $# -lt 2 ]; then echo "$0 " exit 1 fi AUTHORS_FILE="`pwd`/$1" DEST_REPO="$2" if [ ! -e "${AUTHORS_FILE}" ]; then echo "can't find ${AUTHORS_FILE}, aborting" exit 1 fi TMP_REPO=`mktemp -d` TARGET_FILE="testing.txt" cd "${TMP_REPO}" git init . cp "${AUTHORS_FILE}" . git add `basename "${AUTHORS_FILE}"` git commit -m 'Import authors.txt file' cat >> README.txt << EOF This is a dummy repository containing dummy commits It has been created with 1 dummy commit from each contributor in authors.txt so that we can view the commit history in github and work out which contributors are correctly mapped to github accounts. EOF git add README.txt git commit -m 'Add README' cat "${AUTHORS_FILE}" | while read ; do full_info=`echo "${REPLY}" | cut -f2 -d'=' | cut -b2-` an="`echo "${full_info}" | sed -e "s/ <.*\$//\"`" am="`echo "${full_info}" | sed -e "s/^.*> "${TARGET_FILE}" git add "${TARGET_FILE}" export GIT_AUTHOR_NAME="$an" export GIT_AUTHOR_EMAIL="$am" export GIT_COMMITTER_NAME="$cn" export GIT_COMMITTER_EMAIL="$cm" git commit -m "Test adding ${REPLY}" done git remote add origin "${DEST_REPO}" git push -u -f origin master