Rich Dougherty rd.nz

Syncing with a remote repo in Git

My latest workflow…

  1. Check for local changes.$ git status
  2. Commit or stash them. Rebase won’t work with local changes.$ git stash save 'local env settings'
  3. Pull down remote changes and rebase my changes off them.$ git pull --rebase
  4. Get my local changes back.$ git stash pop
  5. Test that everything still works!
  6. Push changes back to the remote repo.$ git push origin

Update: Changed stash apply to stash pop, to avoid creating an infinite number of stashes.