-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch.sh
More file actions
49 lines (31 loc) · 1.11 KB
/
patch.sh
File metadata and controls
49 lines (31 loc) · 1.11 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
#!/bin/bash
# initialize the repository and put our name and email in the .config file
echo -e "\n\n************ CREATING THE REPOSITORY AND CONFIGURING IT\n\n"
rm -rf git-test ; mkdir git-test ; cd git-test
git init
git config user.name "A Smart Guy"
git config user.email "asmartguy@linux.com"
echo -e "\n\n************ CREATING A COUPLE OF FILES AND ADDING THEM TO THE PROJECT AND COMMITTING\n\n"
echo file1 > file1
echo file2 > file2
git add file1 file2
git commit . -m "This is our first commit"
echo -e "\n\n************ MAKING A NEW CLONE\n\n"
cd ..
git clone git-test git-newer
echo -e "\n\n************ MAKING CHANGES TO THE REPOSITORY*\n\n"
cd git-newer
echo another line >> file2
echo a third file > file3
echo -e "\n\n************ ADDING AND COMITTING THE CHANGES\n\n"
git add file2 file3
git commit -m"modifcations from the new clone"
echo -e "\n\n************ PRODUCING THE PATCH*\n\n"
git format-patch -1 -s
mv 00* ..
echo -e "\n\n************ SEEING IF THE PATCH WORKED\n\n"
cd ..
cd git-test
git apply --check ../00*
echo -e "\n\n************* NOW APPLY THE PATCH\n\n"
git am ../00*