|
@@ -10,16 +10,12 @@ files=$(git diff --name-only ${dev_branch}..${test_branch} | egrep ${grep_patter
|
|
|
|
|
|
# 使用for循环遍历文件名列表
|
|
|
for file in $files; do
|
|
|
- # 判断文件是否存在于dev分支
|
|
|
- if git show ${dev_branch}:${file} &> /dev/null; then
|
|
|
- # 如果文件存在于dev分支,使用git checkout命令将文件从test分支复制到dev分支
|
|
|
- echo "git checkout ${test_branch} ${file}"
|
|
|
- git checkout ${test_branch} ${file}
|
|
|
- else
|
|
|
- # 如果文件不存在于dev分支
|
|
|
- echo "git show ${test_branch}:${file} > ${file}"
|
|
|
- git show ${test_branch}:${file} > ${file}
|
|
|
- git add ${file}
|
|
|
+ # 判断文件是否存在
|
|
|
+ if [ ! -f ${file} ]; then
|
|
|
+ mkdir -p "$(dirname "${file}")"
|
|
|
+ touch ${file}
|
|
|
fi
|
|
|
+ echo "git checkout ${test_branch} ${file}"
|
|
|
+ git checkout ${test_branch} ${file}
|
|
|
done
|
|
|
git status
|