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