How do I force "git pull" to overwrite local files?

One big piece of the Linux server puzzle is maintaining mail servers. This section is to provide help to those who work with and maintain Linux mail servers.
Post Reply
admin
Site Admin
Posts: 50
Joined: Sun Aug 08, 2021 7:49 am

How do I force "git pull" to overwrite local files?

Post by admin »

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

The scenario is the following:

A team member is modifying the templates for a website we are working on
They are adding some images to the images directory (but forget 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
They cannot pull updates from GitHub because Git doesn't want to overwrite their files.
This is the error I'm getting:

error: Untracked working tree file 'public/images/icon.gif' would be overwritten by merge

How do I force Git to overwrite them? The person is a designer - usually, I resolve all the conflicts by hand, so the server has the most recent version that they just need to update on their computer.
Post Reply