Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following problem on one of our servers: I want a user that pulls from a Git repo on a regular basis (using a cronjob), but only doing fast-forward pulls (the content on the server changes sometimes, too). With modern Git (1.6.6 and newer), I can simply do

git pull --ff-only origin master

but since I only have installed, I can't do that. I thought I could work around it by doing

git config merge.ff only
git pull origin master

but as it turned out, that did not work (no error, it still does merges though). Any ideas how I can solve this?

share|improve this question
up vote 0 down vote accepted

I've found a solution to this by manually checking if the current branch (master) is actually a descendant of the branch to be merged (origin/master):

git fetch origin
if [ $(git branch --contains master -a | grep origin/master) ]
    git merge origin/master
    echo "No fast-forward, aborting merge"
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.