forked from codinasion/codinasion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rebase.sh
executable file
·43 lines (35 loc) · 820 Bytes
/
rebase.sh
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
#!/bin/bash
read -r -p "Use with caution! Proceed (y/n)? " answer
case $answer in
[Yy]*)
# Update
pnpm git-fetch-prune-verbose
# Checkout to master branch
git checkout master
# Pull the latest changes
git pull
# Checkout to the dev branch
git checkout dev
# Rebase the latest changes from master
git rebase master dev
# Skip all the conflicts
while [ true ]; do
git rebase --skip
if [ $? -eq 0 ]; then break; fi
if ! git rebase --continue 2>/dev/null; then
echo "No rebase in progress. Exiting loop."
break
fi
done
# Force push the changes to the dev branch
git push -f
;;
[Nn]*)
echo "Operation cancelled."
exit 1
;;
*)
echo "Please answer yes or no."
exit 1
;;
esac