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

前端 未结 30 3478
失恋的感觉
失恋的感觉 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 12:17

    You might find this command helpful to throw away local changes:

    git checkout  -f
    

    And then do a cleanup (removes untracked files from the working tree):

    git clean -f
    

    If you want to remove untracked directories in addition to untracked files:

    git clean -fd
    

提交回复
热议问题