-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch_to_github.sh
More file actions
40 lines (32 loc) · 1.08 KB
/
patch_to_github.sh
File metadata and controls
40 lines (32 loc) · 1.08 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
git update-index -q --ignore-submodules --refresh
if ! git diff-files --quiet --ignore-submodules --
then
echo "Warning: Your local changes would be overwritten, Please commit or stash them and try again."
exit
fi
latest_version=`date +"%Y%m%d%H%M"`
echo "version=${latest_version}"
git tag github-${latest_version}
echo "patch start..."
userName=$(git config --get user.name)
userEmail=$(git config --get user.email)
echo "user.name is ${userName}"
echo "user.email is ${userEmail}"
echo -e "changes between the branches:\n $(git diff public github_latest --stat)\e"
echo "patching..."
git checkout github_latest
git diff github_latest public>>tmp.patch
git apply tmp.patch
rm -rf tmp.patch patch_to_github.sh
git config user.name "rainbowPublic"
git config user.email "rainbow_leon@163.com"
git add .
git commit -m "latest"
git push github HEAD:master
echo "revert user info"
git config user.name "${userName}"
git config user.email "${userEmail}"
git checkout master
echo "user.name is $(git config --get user.name)"
echo "user.email is $(git config --get user.email)"
echo "patched success"