Skip to content

Commit d5c2e8d

Browse files
committed
echo need delete files
1 parent 50ce7c7 commit d5c2e8d

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

git_pull.sh

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
#!/bin/sh
2+
#
3+
# author: yanue
4+
# time: 2015-11-28
25
# git pull tool
36
# when project has untracked and local change files
7+
#
48
# usage:
59
# gpl [project path]
610
#
11+
# update:
12+
# -- echo delete files
13+
#
714
# author: yanue
815
916
# time: 2015-11-28
17+
# update: 2016-01-07
1018

11-
tmp_file='/tmp/git_pull_error';
19+
tmp_file='/tmp/git_pull_tmp';
1220
git='/usr/local/bin/git';
1321

1422
if [ $# -gt 0 ] ;then
@@ -33,17 +41,19 @@ $git pull 2> $tmp_file;
3341
# if has errors
3442
if [ $? != 0 ]; then
3543
# delete untracked and local change files
36-
# --all those files each have an epmty space char
44+
## all those files each have an epmty space char
45+
echo 'need delete files:';
46+
cat $tmp_file | sed -n '/^\s/p' | awk '{print " "$1}'
3747
cat $tmp_file | sed -n '/^\s/p' | awk '{print $1}' | xargs rm -f
38-
# git pull again
48+
# pull again
3949
$git pull;
4050
# set tmp file to empty
4151
cat /dev/null > $tmp_file;
4252
fi
4353

4454
# addon options
45-
chmod -R 777 data cache uploads avatar
55+
chmod -R 777 .
4656
chown -R www.www .
4757

4858
# end
49-
echo 'done'
59+
echo 'done'

0 commit comments

Comments
 (0)