I want to create a shell
script that add
, commit
and push
new or changed files to a repository. Currently, my script is doing this by iterating file by file, which takes too much time. My requirement is to still doing this file by file, but this time I just want to iterate over the new or changed files.
My shell
script is as follows:
#!/bin/sh
CUR_DIR=$(pwd)
PROJECT_DIR="${CUR_DIR}"
for fileToCommit in $(find ${PROJECT_DIR}/* -type f);
do
test -f "$fileToCommit" || continue
printf "%s\n" "${fileToCommit}"
git add "${fileToCommit}"
git commit -a -m "[ADD] New ${fileToCommit##*/} File"
git push
done
How can I do it in an effortless way?