Error in git pull code

I have added the file

database.php to .gitignore, but the pull code appears

error: refusing to lose untracked file at "application/database.php"

enter

git status

appears

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)

        deleted by us:   application/database.php

the prompt is to call me add or rm, and then I submit and push, which means that the online application/database.php is also deleted.

Git
Oct.27,2021

.gitignore can ignore untracked files, but will not ignore files that have been tracked (such as git add-f or in your current situation).
so in addition to modifying the .gitignore file, you also need git rm-- cached application/database.php to delete the tracked file.


this is the bifurcation of the branch (that is, your branch and the corresponding branch of the server have a common base point, and then develop in different directions)

1.pull will use git merge to cause conflicts. You need to resolve the conflicting files and drop git add-u, git commit before you can successfully pull.

2. If you want to discard local file changes, you can use git reset-- hard FETCH_HEAD,FETCH_HEAD to represent the commit point formed after the last successful git pull. Then git pull.

Menu