0

A co-worker has to use the force update option (in the GIT Zend Studio plugin) - otherwise we do not receive the commits he pushed.

I think this corresponds to git push -- force which looks dangerous to me:

--force
Usually, the command refuses to update a remote ref that is not an ancestor of the local     
ref used to overwrite it. This flag disables the check. This can cause the remote  
repository to lose commits; use it with care.

What configuration has to be changed?

Romain
  • 12,679
  • 3
  • 41
  • 54
Alex
  • 32,506
  • 16
  • 106
  • 171

1 Answers1

2

It's not a problem with the configuration, it's a problem with the workflow, I believe. Git only tries to avoid you causing the remote to lose history (that is, make some commits that used to be reachable from the HEAD be unreachable from it) when you push. If you have to force, it means you're re-writing remote history, and this is a symptom that the repository history is either screwed up or not up to date.

The typical resolution for having to git push -f is actually to begin by updating the local history on top of the remote history using git pull or git pull --rebase, which ensures you're getting the newest entries from the remote incorporated in your local history (be it by merge or rebase).

Romain
  • 12,679
  • 3
  • 41
  • 54