git_如何查看两个版本之间那些文件被修改
- 需求
由于工程比较庞大,接近500M,每部署一次如果都全量部署,不仅仅磁盘空间耗费较大,最主要是要等很长时间,
之前就一直有这个问题,但是也就没有弄,上周领导发话了,这个问题必须要解决了
-
前记
- 增加带宽,这个显然不太合适
- 只部署更新的文件,嗯,就是这样
要解决上面的问题,可能有这么几个方案
- 相关命令
这里--name-only参数只会列出变化的文件名,列表,显示根据需要对这个结果非常的满意
git diff HEAD^ HEAD^^ --name-only
- 示例
我们版本控制工具是在用git,所以就直接使用git自带的命令了,所以这个仅供参考下,另外也可以参考下inotify
#!/bin/bash
diff_path_file_list="/tmp/a"
diff_path_dir_list="/tmp/b"
git diff HEAD^ HEAD^^ --name-only > $diff_path_file_list
for path in $(cat $diff_path_file_list)
do
dirname $path >> $diff_path_dir_list
done
clear
echo -e "\033[31;1m需要更新的文件如下\033[0m"
echo
cat $diff_path_dir_list | sort | uniq
rm -f $diff_path_file_list
rm -f $diff_path_dir_list
Yesterday is history.
Tomorrow is a mystery.
But today is a gift.
That is why it's called the present.
The old game: give a wolf a taste, then keep him hungry.
Tomorrow is a mystery.
But today is a gift.
That is why it's called the present.
The old game: give a wolf a taste, then keep him hungry.