写一个脚本使用git pull 时忽略指定的多个文件
#!/bin/bash
忽略的文件列表,以空格分隔
IGNORE_FILES="file1 file2 file3"
循环遍历忽略的文件列表
for file in $IGNORE_FILES do
执行git命令,将忽略文件添加到git忽略列表
git update-index --assume-unchanged $file done
执行git pull命令,拉取最新代码
git pull
循环遍历忽略的文件列表
for file in $IGNORE_FILES do
执行git命令,将忽略文件从git忽略列表中删除
git update-index --no-assume-unchanged $file done
提示代码拉取完成
echo "Git pull completed."
原文地址: https://www.cveoy.top/t/topic/dhVf 著作权归作者所有。请勿转载和采集!