forked from nelsonchung/sync_utility
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitcmd
More file actions
executable file
·104 lines (102 loc) · 2.94 KB
/
gitcmd
File metadata and controls
executable file
·104 lines (102 loc) · 2.94 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
================================Function=======================================================================
git_remote_add_upstream(){
echo "Please input the remote http path"
read remote_path
git remote add upstream "$remote_path"
}
git_fetch(){
git fetch
}
git_push(){
git push
}
================================UI=============================================================================
echo "1. 更新來自遠端的資訊: git pull"
echo "2. 同步本地端資料到遠端: git push"
echo "3. 無條件使用遠端的資訊: git reset --hard origin/master"
echo "4. 顯示log: git log --stat"
echo "5. 顯示Remote端repository: git remote show origin"
echo "51. 顯示Remote端repository(簡化版): git remote -v"
echo "52. 加入Remote端repository: git remote add upstream some_path"
echo "6. 顯示上次改變的內容: git show"
echo "7. 合入patch: git apply"
echo "71. 產生patch: git diff"
echo "72. 從別的branch合入patch git merge --no-ff xxx_branch"
echo "8. 設定Local端的資訊: git config user.name, git config user.email "
echo "9. 更新fork branch的資料: git checkout master, git pull upstream master and checkout back"
echo "10. 同步遠端伺服器上的資料到本地: git fetch"
echo "101. 同步遠端以及fork出來的project: run 52 and 10"
echo "99. 目前狀況: git status"
read option
case "$option" in
//"")
//;;
"1")
git pull
;;
"2")
git_push()
;;
"3")
git reset --hard origin/master
;;
"4")
git log --stat
;;
"5")
git remote show origin
;;
"51")
git remote -v
;;
"52")
git_remote_add_upstream()
;;
"6")
git show
;;
"7")
echo "Please input the name patch file"
read patch_file
git apply "$patch_file"
;;
"71")
echo "Please input the name of patch file"
read patch_file
git diff > "$patch_file"
;;
"72")
echo "Please input the name of branch"
read branch_name
git merge --no-ff "$branch_name"
;;
"8")
echo "Please input the username"
read username
git config --global user.name "$username"
echo "Please input the email"
read email
git config --global user.email "$email"
;;
"9")
git checkout master
git pull upstream master
git checkout nelson_develop
;;
"10")
git_fetch()
;;
"101")
git_remote_add_upstream()
git_fetch()
//If there is no any conflict, you can run git_push
git_push()
;;
"99")
git status
;;
*)
echo "Not support"
exit 1
;;
esac