A simple Git deployment Bash script.
Create bin in the main user directory by navigating to ~ (which is a shortcut for current user home directory, or /Users/username).
cd ~ # this takes us to /Users/username
mkdir bin # this creates /Users/username/binOpen .bash_profile, which will be located at /Users/username/.bash_profile, and add this line to the file. If .bash_profile doesn't exist, create it.
export PATH=$PATH:/Users/tania/binIf you don't see hidden files and directories, or those that begin with a .
Go to your bin folder located in /Users/username.
cd binCreate a file called git-deploy (no extension) in this folder.
touch git-deployOpen the file in your text editor of choice and type the following.
#!/usr/bin/bashA bash script must always begin with #!/bin/bash to signify that the script should run with bash as opposed to any other shell. This is called a "shebang". You can confirm where the bash interpreter is located with which bash.
which bashNow edit the git-deploy file
#!/usr/bin/bash
read -r -p 'Commit message: ' desc # prompt user for commit message
git add . # track all files
git add -u # track deletes
git commit -m "$desc" # commit with message
git push origin master # push to originMake it an executable file by changing the permissions.
chmod u+x git-deployThen just run the command.