背景
开启了sparse-checkout 过滤了文件xxx
远端仓库master,有大量更新,包括xxx
本地仓库有一个分支A,想要merge 远端的master
commit xxx时报错:
报错
git commit failed with error
the following paths and/or pathspecs matched paths that exist outside of your sparse-checkout definition, so will not be updated in the index:
hint: If you intend to update such entries, try one of the following:
hint: * Use the --sparse option.
hint: * Disable or modify the sparsity rules.
hint: Disable this message with “git config advice.updateSparsePath false”
解决办法
无效 git config advice.updateSparsePath false
有效 先关闭,merge 、push 之后再开启
git config core.sparse-checkout false
git fetch origin/master
git commit
git push
git config core.sparse-checkout true