-
Notifications
You must be signed in to change notification settings - Fork 1
/
update-project-boilerplate.sh
executable file
·54 lines (38 loc) · 1.36 KB
/
update-project-boilerplate.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
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
if [ ! -d "./.git/" ] && [ ! -f "./.git" ]
then
echo -e "This command is only to be used when the project is in the root directory of a Git repository"
else
echo "-----
WARNING!!! This will erase any uncommited changes that you have right now.
To cancel the update press Ctrl+C. Commit and push your changes first and then run this update command again.
To continue with the update write yes and press Enter.
-----"
read user_has_continued
if [ "$user_has_continued" != "yes" ]; then
echo "Update canceled"
exit 0
fi
echo "Paste the URL of the git repository where the boilerplate is"
read git_url
echo "What is the name of the git branch where the updates are?"
read git_branch
echo "Updating..."
git add .
git reset --hard
git remote remove boilerplate
git remote add boilerplate $git_url
git fetch boilerplate $git_branch
git merge "boilerplate/${git_branch}" --no-commit
echo "
-----
-----
-----
----- FURTHER INSTRUCTIONS
- Review and pick the updates you want to add to the project
- Run 'npm install', in case any dependencies were changed or added
- Check if any of the changes made by the updates require a new migration to be written
- Run 'git add .' to stage all the accepted updates
- IF YOU WANT TO ABORT the update, run 'git merge --abort'
- To finalize the update, run 'git merge --continue'"
fi