git pull, keep untracked files ignore and overwrite tracked file modified or deleted

StackOverflow https://stackoverflow.com/questions/22699179

  •  22-06-2023
  •  | 
  •  

Вопрос

I would like to do a git pull to the production server but I'm having some issues.

Someone deleted a tracked file on the server and also modified a file on the server. The server also adds untracked files that it uses for logs and such.

I would like to do a git pull that will override all tracked files and keep untracked files in tact.

Right now when i do a "git pull origin master" I get the following:

error: Your local changes to the following files would be overwritten by merge: free_profile.php

I've found this on stack overflow: Git force overwrite of local tracked files but not local untracked files

But I'm not sure if this is the appropriate solution. It's a production server so I need to make sure I'm doing the right thing.

Это было полезно?

Решение

Do you mean someone deleted a file, but not yet committed, and you want to retrieve it?

If so, please try to use

git checkout -- your_deleted_file

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top