How To GIT Commit and Push to Branch on Macbook Lid Close
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!
Leave How To GIT Commit and Push to Branch on Macbook Lid Close to:
Read more #programming posts
Best Posts From donmesswithabeer
We have not curated any of donmesswithabeer's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From donmesswithabeer
- How To GIT Commit and Push to Branch on Macbook Lid Close
- How to Scrape a Steemit Post with Javascript (Node.js)
- New Codrop Creative Style Buttons for React
- Use Bitbucket for hosting private npm modules
- How to Store Passwords in Google Drive with Node.js
- Wiring Modules Part 1: The Art of Writing Modules (Hardcoded Dependencies)
- Wiring Modules in Node.js: Introduction