I have no shell scripting experience. I want to create a shell script that will fetch changes from GIT and commit these changes to the SVN repository.
After searching a lot online and reading this link: Shell script to check git for changes and then loop through changed files?
i could come up with the following...
#!/bin/sh
#checks if there are any changes
if ! git --git-dir="/dir/.git" diff --quiet
then
# do stuff...
git --git-dir="/dir/.git" diff-tree ORIG_HEAD.. | \
while read srcmode dstmode srcsha dstsha status srcfile dstfile
do
# do something with $srcfile and $dstfile
done
fi
I guess the above will get changes from the GIT repo. Am I on the right path here? And now in the loop I want to commit the changes obtained from GIT.
How can this be done ?
I will be adding this script in Jenkins and it will execute as a post-build action.