Alright, this is something I wanted to do because I sometimes forget to push changes or perhaps didn't want to push to the branch I'm working on. I'll show you how to auto commit and push to a specific branch on macbook lid close. In fact you can run any script on close. Its a simple 3 step process
- Install https://github.com/fishman/sleepwatcher
- Create a SH script file to run on lid close (here's mine)
#!/usr/bin/env sh
cd /path/to/branch
git checkout -b auto-save
git push -f --set-upstream origin auto-save
git add .
git commit -m "sleep autosave" --no-verify
git push -f
3 Run this command at mac startup (https://stackoverflow.com/questions/6442364/running-script-upon-login-mac)
/usr/local/sbin/sleepwatcher --verbose --sleep ./path-to-script.sh
Enjoy!
Congratulations @donmesswithabeer! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Do not miss the last post from @steemitboard:
Vote for @Steemitboard as a witness to get one more award and increased upvotes!