我有一个应用补丁的脚本,有时会因为各种原因(例如文件权限)而失败。我想在修复问题后再次运行脚本,但是之前的git应用尝试可能会留下一些未清理的文件。
我不想运行
我的脚本:
当我再次运行时,我得到了以下结果:
我不想运行
git clean
,因为这会扔掉其他我想保留的文件。我只想替换那些受补丁影响的未跟踪文件。我的脚本:
for SITE in $SITES
do
echo "Updating $SITE ..."
cd /home/klausi/web/$SITE
chmod u+w sites/default
git fetch
git reset --hard origin/master
git apply --index /home/klausi/web/7.33.patch
git commit -m "Updated Drupal core to 7.33."
git push
done
当我再次运行时,我得到了以下结果:
error: misc/throbber-active.gif: already exists in working directory
error: misc/throbber-inactive.png: already exists in working directory
error: modules/simpletest/tests/themes/test_theme/templates/node--1.tpl.php: already exists in working directory
希望有类似于 git apply --force
的操作。