Auto-sync GitHub main branch changes on macOS

Setting up automatic Git sync on Mac

I’m working on a React Native iOS project and have a specific workflow setup. I write most of my code on a Windows machine and use a MacBook to run the iOS simulator.

Here’s what I’m currently doing:

  • Writing code on Windows PC
  • Pushing changes to GitHub repository
  • Manually running git fetch and git pull on my Mac
  • Testing the updates in the iOS simulator

This manual process is getting tedious. I want to automate the pulling process so that whenever I push new commits to the main branch from my Windows machine, my Mac automatically downloads those changes.

Is there a way to set up automatic git pulling on macOS? I’ve looked around but couldn’t find Mac-specific solutions that work reliably.

Hazel works great for this. I use it to monitor my project folder and auto-pull whenever the .git directory changes. Set up a rule watching .git/refs/remotes/origin for modifications, then add a shell script action to run your git commands. Just add a 30-second delay so you don’t get conflicts when multiple commits come in fast. This setup has saved me tons of time, especially when I’m bouncing between my Linux dev machine and Mac for testing. It runs silently in the background and you’ll forget it’s even there.