Shell Script On Git Merge Commit

I am currently trying to automate the build process we are using using a shell script.

I currently have a shell script running for a commit that is not a merge commit using the script below. $ 1 and $ 2 are where the files are and where they are also copied. $ 3 is the commit hash.

 cd $1
 echo "Copying to $2" 
 for i in $(git show -c --pretty="format:" --name-only $3) 
     do 
        # First create the target directory, if it doesn't exist. 
        mkdir -p "$2/$(dirname $i)" 
        # Then copy over the file. 
        cp "$i" "$2/$i" 
    done 
echo "Done"; 

      

I can get this to work for the merge command anyway, as we only ever release files that were changed in a merge.

+3


source to share





All Articles