In a rails project, I had to repeat the same steps very frequently, for example :
gco master
git pull
It was boring because I often forget some important steps for my project. I started to use shell scripts. A shell script allows us to automate series of command lines that we must repeat every times in a day of work.
Here the basic configuration I made :
cd bin
➜ bin git: touch name_of_the_file.sh
#!bin/bash
ls
➜ bin git: ./name_of_the_file.sh
Unfortunately, we can see the file is not executable. To resolve it, run the command :
chmod +x name_of_the_file.sh
#!bin/bash
git checkout master
git pull
git push staging master:master
heroku run rake db:migrate --my_app
In command line :
./bin/name_of_your_file.sh
Why using shell scripts can make us save time ?