也许您可以使用bash脚本在您的回购中自动执行此过程。以下脚本将获取您在第一个变量中设置的所有文件路径,并找到最后修改的路径。从那里它将该文件复制到其他所有文件,将它们添加到repo,然后提交。
#!/usr/bin/env bash
declare -a filePaths=(“Orange/snippets/code.html” “Green/snippets/code.html” “Blue/snippets/code.html”)
declare newestFile
for file in “${filePaths[@]}”; do
echo “current file is $file”
if [[ “$file” -nt ${newestFile} ]];
then
newestFile=”${file}”
fi
echo “newest file is ${newestFile}”
done
for file in “${filePaths[@]}”; do
if ! [[ “$file” -ef $newestFile ]];
then
echo “copying ${newestFile} to ${file}”
cp ${newestFile} ${file}
currentDir=dirname "${file}"
cd ${currentDir}
git add ${file}
git commit -m ‘automatic update commit’
fi
done
</code>
修改code.hmtl文件后,您可以运行此脚本或使其成为生产管道的一部分。