Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We have a remote git repo that we normally deploy from using git push on our dev server then git pull on on our live servers to get the latest pushed version of the repo.

But if we have committed and pushed a few revisions (without a git pull on the live servers) how can we do a git pull that is referring to the older commit that we want?

i.e. something like git pull -r 3ef0dedda699f56dc1062b5dcc2c59f7ad93ede4

share|improve this question

2 Answers 2

up vote 12 down vote accepted

Once you've pulled the repository you should be able to go:

git checkout 3ef0d...
share|improve this answer
Nice, this worked perfectly. Also noticed that if I want to get back in sync for future pulls I need to specify the remote server when doing the next pull (i.e. git pull server:repo vs the regular git pull) –  dlrust Feb 26 '10 at 19:01

If some process on your live server immediately accesses the just-pulled content (i.e. you cannot work with git checkout 3ef0d after pull), you should consider tagging the version you want to deploy in production and specifically checkout that tag on production, so that pulling does not immediately change your working directory. Otherwise you'd risk somebody pushing just prior to your pull.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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