#!/bin/bash # GitInitOperation script # # $1 is the git tool path # $2 is the path of our project. # # The idea is to init, add a dummy file, and then commit. This gets # our repository setup such that we can see HEAD, the master branch # and do many other normal git commands without worry of an error. cd "$2" GITINITRESULT=`"$1" init` RESULTCODE=$? if [ $RESULTCODE -ne 0 ] ; then # echo $RESULTCODE exit $RESULTCODE fi echo "Hello World!\n" > "README.txt" GITADDRESULT=`"$1" add "README.txt"` RESULTCODE=$? if [ $RESULTCODE -ne 0 ] ; then # echo $RESULTCODE exit $RESULTCODE fi GITCOMMITRESULT=`"$1" commit -m "Initial commit."` RESULTCODE=$? if [ $RESULTCODE -ne 0 ] ; then # echo $RESULTCODE exit $RESULTCODE fi exit 0