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

前端 未结 30 3845
失恋的感觉
失恋的感觉 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条回答
  •  萌比男神i
    2020-11-21 11:59

    I summarized other answers. You can execute git pull without errors:

    git fetch --all
    git reset --hard origin/master
    git reset --hard HEAD
    git clean -f -d
    git pull
    

    Warning: This script is very powerful, so you could lose your changes.

提交回复
热议问题