4

I have N+2 repositories in drive E:

  1. Test_central - central repository;
  2. Test_primary1 - local repository;
  3. Test_primaryN - local repository;
  4. Test_slave - local repository.

How can I update Test_slave when Test_primaryI has pushed its own changes to Test_central?

P.S.: all repositories on one drive only for testing

Cœur
  • 37,241
  • 25
  • 195
  • 267
dsm
  • 63
  • 5

1 Answers1

5

You'll want to hook into one of the available hooks in the Test_slave repo. Have a look here. It's as simple as writing a script to do what you want, giving it the correct name in the .git/hooks folder, and making it executable.

To make things nice and easy, example scripts are already provided in the hooks folder. Just remove the .sample extension from the .sample file for hook you'd like to use, and then edit the script to suit your needs.

GarlicFries
  • 8,095
  • 5
  • 36
  • 53
  • 2
    Note that you'll need to put the hook in the initial recieving repository, `Test_central` or the sending repository `Test_primaryX`. You can't put them in `Test_slave` - as pushing from `Test_primary` to `Test_central` will never touch `Test_slave` and so it wont know to fire any of its hooks. – Michael Anderson Jul 26 '12 at 12:16
  • I tried to change the hook post-update.sample for Test_central, but nothing has happened. Script: #!/bin/sh cd e:\Test_slave\ || exit unset GIT_DIR git pull origin master exec git-update-server-info – dsm Jul 26 '12 at 13:34