我无法帮助您欺骗 IE,我认为从这个角度来看,您正在寻找的东西是不可能的(并且不鼓励,因为这不是 Github 原始 URL 的目的)。
但是,您可以自动提交更改gh-pages
并推送,以使您的生活更轻松。您可以使用 apost-commit hook
来gh-pages
自动更新分支中的相关文件。我post-commit
编写了这样一个脚本来监视对某些文件的更改并将它们提交到另一个分支:
#!/bin/sh
WATCH_BRANCH="master"
WATCH_FILES="jquery-imask-min.js"
DEST_BRANCH="gh-pages"
# bail out if this commit wasn't made in the watched branch
THIS_BRANCH=$(git branch --no-color | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/');
if [ "$THIS_BRANCH" != "$WATCH_BRANCH" ]; then
exit 0
fi
# only update if watched files have changed in the latest commit
CHANGED_FILES=$(git show --pretty="format:" --name-only $WATCH_BRANCH)
if $(echo "$CHANGED_FILES" | grep "^$WATCH_FILES$" -q); then
# checkout destination branch, then
# checkout latest version of each watched file and add to index
git checkout -q $DEST_BRANCH
git pull -q
SAVEIFS=$IFS
IFS=$(echo -n "|")
for file in $WATCH_FILES; do
git checkout $WATCH_BRANCH -- $file
git add $file > /dev/null
done
IFS=$SAVEIFS
# commit with a chance to edit the message, then go back to watched branch
LATEST_COMMIT=$(git rev-parse $WATCH_BRANCH)
git commit -m "Also including changes from $WATCH_BRANCH's $LATEST_COMMIT"
git push origin $DEST_BRANCH
git checkout -q $WATCH_BRANCH
fi
请注意,这是一个通用脚本,但我已在顶部指定了配置变量以供您使用。$WATCH_FILES
可以设置为由大括号分隔的文件列表,|
例如index.html|js/jquery.js
. 必须相对于存储库的根指定路径。
如果您有任何问题,以及脚本是否对您有帮助,请告诉我!