Fetching all remote branches into a bare Git repository

Viewed 8191

I set up a Github post-receive hook, which runs a script on my web server whenever a push is made to my Github repository.

When the script runs, I want it to keep a local bare clone of the repository synchronized with my Github repository. To do this, I have it run this command:

git fetch origin && git reset --soft refs/remotes/origin/master

Then, if from my workstation I push to master on Github, everything works just fine. However, if I push to another remote branch, the changes are not reflected in my server's local bare repository.

I'm assuming there's some way to have the script fetch all of the remote branches, but I don't know how to do this. I know newer versions of git have a --all option for fetch/pull, but I'm using git version 1.6.3.3, which doesn't seem to have this option.

Does anyone know how I can get my script to fetch all remote branches?

Thanks!

4 Answers

git fetch origin *:* worked for me on Windows.

git version 2.29.2.windows.3

Related