In what cases could `git pull` be harmful?

后端 未结 5 1725
庸人自扰
庸人自扰 2020-11-28 00:17

I have a colleague who claims that git pull is harmful, and gets upset whenever someone uses it.

The git pull command seems to be the canon

5条回答
  •  不知归路
    2020-11-28 00:49

    My answer, pulled from the discussion that arose on HackerNews:

    I feel tempted to just answer the question using the Betteridge Law of Headlines: Why is git pull considered harmful? It isn't.

    • Nonlinearities aren't intrinsically bad. If they represent the actual history they are ok.
    • Accidental reintroduction of commits rebased upstream is the result of wrongly rewriting history upstream. You can't rewrite history when history is replicated along several repos.
    • Modifying the working directory is an expected result; of debatable usefulness, namely in the face of the behaviour of hg/monotone/darcs/other_dvcs_predating_git, but again not intrinsically bad.
    • Pausing to review others' work is needed for a merge, and is again an expected behaviour on git pull. If you do not want to merge, you should use git fetch. Again, this is an idiosyncrasy of git in comparison with previous popular dvcs, but it is expected behaviour and not intrinsically bad.
    • Making it hard to rebase against a remote branch is good. Don't rewrite history unless you absolutely need to. I can't for the life of me understand this pursuit of a (fake) linear history
    • Not cleaning up branches is good. Each repo knows what it wants to hold. Git has no notion of master-slave relationships.

提交回复
热议问题