2

Im a bit new to using git. We have a git repository with a couple of users. Is there a way to automatically sync changes down without having to press sync/do a git pull?

So when someone else does a git push it automatically syncs my instance of it. A bit like how dropbox works?

2
  • You could probably pull it off with post-commit hooks if the server is given SSH logins to all the developer machines - but why would you want your code to all of a sudden be updated while you are working on it? May 23, 2013 at 11:25
  • Not easily possible. The server has to know all the clients to notify them and the clients should be open to receive notifications from the server (and the run the git pull). Or you could set a cron job that periodically pulls all your repos. May 23, 2013 at 11:25

2 Answers 2

2

Git does not support that kind of feature. The closest thing you could do to mimic this behavior would be to use git-hooks that would when someone of your team pushes, pull all collaborator repository automatically.

This will however be quite complex to setup (especially to update an actual user working directory) and will inevitably lead to issues (when, for example you are working on a some file that another use has juste updated; Git will refuse to pull and you'll have to perform a merge operation by hand).

SCMs such as Git never update your working copy automatically.

0

There are tools that can do this for you.

For instance HighFlux automatically pulls changes from trunk into your working copy (as long as there are no conflicts): https://www.highflux.io/docs/conflicts#keeping-your-work-up-to-date-with-trunk

There are probably other tools that can do the same for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.