How do I force “git pull” to overwrite local files?

前端 未结 30 3524
失恋的感觉
失恋的感觉 2020-11-21 11:35

How do I force an overwrite of local files on a git pull?

The scenario is the following:

  • A team member is modifying the t
30条回答
  •  自闭症患者
    2020-11-21 11:56

    Bonus:

    In speaking of pull/fetch/merge in the previous answers, I would like to share an interesting and productive trick,

    git pull --rebase

    This above command is the most useful command in my Git life which saved a lot of time.

    Before pushing your newly commit to server, try this command and it will automatically synchronise the latest server changes (with a fetch + merge) and will place your commit at the top in the Git log. There isn't any need to worry about manual pull/merge.

    Find details in What does "git pull --rebase" do?.

提交回复
热议问题