File tree 1 file changed +15
-5
lines changed
1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
+ #
3
+ # author: yanue
4
+ # time: 2015-11-28
2
5
# git pull tool
3
6
# when project has untracked and local change files
7
+ #
4
8
# usage:
5
9
# gpl [project path]
6
10
#
11
+ # update:
12
+ # -- echo delete files
13
+ #
7
14
# author: yanue
8
15
9
16
# time: 2015-11-28
17
+ # update: 2016-01-07
10
18
11
- tmp_file=' /tmp/git_pull_error ' ;
19
+ tmp_file=' /tmp/git_pull_tmp ' ;
12
20
git=' /usr/local/bin/git' ;
13
21
14
22
if [ $# -gt 0 ] ; then
@@ -33,17 +41,19 @@ $git pull 2> $tmp_file;
33
41
# if has errors
34
42
if [ $? != 0 ]; then
35
43
# 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}'
37
47
cat $tmp_file | sed -n ' /^\s/p' | awk ' {print $1}' | xargs rm -f
38
- # git pull again
48
+ # pull again
39
49
$git pull;
40
50
# set tmp file to empty
41
51
cat /dev/null > $tmp_file ;
42
52
fi
43
53
44
54
# addon options
45
- chmod -R 777 data cache uploads avatar
55
+ chmod -R 777 .
46
56
chown -R www.www .
47
57
48
58
# end
49
- echo ' done'
59
+ echo ' done'
You can’t perform that action at this time.
0 commit comments