-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGit.sh
More file actions
executable file
·40 lines (36 loc) · 959 Bytes
/
Git.sh
File metadata and controls
executable file
·40 lines (36 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /bin/bash
#git pull로 최신화
# 원하는 디렉토리 및 파일 add
# 원하는 문구 입력할 수 있도록
# git push 할때 어떤 branh를 입력할것인지
read -p 'git add {directory} : ' directory
read -p 'git commit -m {message} : ' message
read -p 'git push origin {??} : ' branch
read -n2 -p 'git pull origin : [Y,N] : ' pullValid
exec 2> error.txt
#global Variable
echo "입력한 값은 : $directory $message $branch $pullValid"
result=0
function gitPushFun(){
git add $directory
wait
git commit -m '"'"$message"'"'
wait
git push origin $branch
result=2
}
if [[ $pullValid == "Y" || $pullValid == "y" ]]; then
if [[ $(git pull origin master) =~ "Already" ]]; then
echo "Already: Git pull"
result=1
else
gitPushFun
fi
else
gitPushFun
fi
if [[ $result -eq 1 ]]; then
echo 'git pull이 이미 진행 되었습니다.'
fi
# # if [[ $? -eq 0 ]]; then
# echo $result