-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_script.sh
More file actions
executable file
·234 lines (216 loc) · 3.41 KB
/
test_script.sh
File metadata and controls
executable file
·234 lines (216 loc) · 3.41 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
#!/usr/bin/env bash -vx
mkdir first_repository
cd first_repository
clear
# "Configuring"
# git config --global user.name "Vlad Dracula"
# git config --global user.email "vlad@tran.sylvan.ia"
# git config --global color.ui "auto"
# git config --global core.editor "nano"
# export EDITOR=nano
read
clear
# "Setup"
git init
read
ls -lah
read
git status
read
clear
# "Creating a file"
echo "Cold and dry, but everything is my favorite color" > mars.txt
read
git status
read
clear
# "Adding the file to the stage"
git add mars.txt
read
git commit -m "adding file mars.txt"
read
git status
read
git log
read
clear
# "Changing a file"
echo "The two moons may be a problem for Wolfman" >> mars.txt
git status
read
git diff
read
git commit -m "Extending file mars.txt"
read
git add mars.txt
read
git commit -m "Extending file mars.txt"
read
clear
# "Staging"
echo "But the Mummy will appreciate the lack of humidity" >> mars.txt
git diff
read
git add mars.txt
read
git diff
read
git diff --staged
read
git commit -m "Extending file mars.txt even more"
read
git status
read
git log
read
clear
# "Exploring history"
read
git diff HEAD~1 mars.txt
read
git diff HEAD~2 mars.txt
read
clear
# "Adding another file"
echo "The smallest one..." > pluto.txt
git add pluto.txt
read
git commit -m "adding file pluto.txt"
read
git status
read
git log
read
clear
# "Removing a file"
git rm pluto.txt
git status
read
git commit -m "Pluto is no longer a planet..."
read
git log
read
clear
# "Recovering a change before committing it"
read
echo "We will need to manufacture our own oxygen" > mars.txt
git status
read
git checkout HEAD mars.txt
read
cat mars.txt
read
clear
# "Ignoring files"
mkdir results
touch a.dat b.dat c.dat results/a.out results/b.out
git status
read
echo '*.dat' > .gitignore
echo 'results/' >> .gitignore
cat .gitignore
read
git add .gitignore
read
git commit -m "Add the ignore file"
read
git status
read
clear
# "Using 'remote' repository"
cd ..
mkdir server_repository
cd server_repository
read
git init --bare
read
cd ../first_repository
git remote add origin ../server_repository
read
git push --set-upstream origin master
read
clear
# "Cloning the 'remote' repository"
cd ..
read
git clone server_repository second_repository
cd second_repository
read
git status
read
# "Adding new file from this second directory"
echo "In directory second_repository" > jupiter.txt
read
git add jupiter.txt
read
git commit -m "adding new file jupiter.txt"
read
git push
read
git status
read
clear
# "Getting these changes from the first directory"
cd ../first_repository
git status
read
ls -l
read
git fetch
read
git status
read
git pull
read
ls -l
read
clear
# "Working with branches"
git branch -a
read
git branch featureX
read
git branch -a
read
git status
read
clear
git checkout featureX
read
git status
read
echo "This will be a great new feature," >> mars.txt
echo "let's call it 'X'" >> mars.txt
git add mars.txt
git commit -m "Started working on feature X"
read
git log
read
clear
git checkout master
read
git log
read
tail mars.txt
read
echo "Meanwhile, on jupiter..." >> jupiter.txt
git add jupiter.txt
git commit -m "working on master in parallel..."
read
git log
read
git checkout featureX
read
git merge master -m "Merge branch 'master' into featureX"
read
git log
read
clear
# Either delete the branch or push it to the remote repository:
# git push origin featureX
# git branch -d featureX
read
clear
# "View History"
git log --oneline --graph --decorate --all
read