問題:
How do I force an overwrite of local files on a git pull
? 如何在git pull
上強制覆蓋本地文件? git
The scenario is following: 該場景以下: web
- A team member is modifying the templates for a website we are working on 團隊成員正在修改咱們正在工做的網站的模板
- They are adding some images to the images directory (but forgets to add them under source control) 他們正在將一些圖像添加到圖像目錄(可是忘記在源代碼控制下添加它們)
- They are sending the images by mail, later, to me 他們經過郵件將圖像發送給我
- I'm adding the images under the source control and pushing them to GitHub together with other changes 我將圖像添加到源代碼管理下,並將其與其餘更改一塊兒推送到GitHub
- They cannot pull updates from GitHub because Git doesn't want to overwrite their files. 他們沒法從GitHub提取更新,由於Git不想覆蓋其文件。
This is the error I'm getting: 這是我獲得的錯誤: 服務器
error: Untracked working tree file 'public/images/icon.gif' would be overwritten by merge 錯誤:未跟蹤的工做樹文件「 public / images / icon.gif」將被合併覆蓋 網站
How do I force Git to overwrite them? 如何強制Git覆蓋它們? The person is a designer - usually I resolve all the conflicts by hand, so the server has the most recent version that they just needs to update on their computer. 這我的是設計師-一般我會手工解決全部衝突,所以服務器具備他們只需在計算機上更新的最新版本。 spa
解決方案:
參考一:
https://stackoom.com/question/4ium/如何強制-git-pull-覆蓋本地文件
參考二:
https://oldbug.net/q/4ium/How-do-I-force-git-pull-to-overwrite-local-files