Search code examples
gitversion-controlatlassian-sourcetree

Cannot discard nor remove the mysterious file in Sourcetree


click to see the image

I've been working on the project. In the middle of the day, this file had unknowingly popped up on the "Staged files". I couldn't do anything to it.

I checked in the explorer. This file was still there. It's a regular text file.

Does anybody have any ideas?

Here are what I've tried to solve the problem:

  • reset the branch - hard
  • stash the file
  • use terminal
  • checkout another branch and come back to the current branch

None of these worked.


Solution

  • This is the solution.

    I use git reset on the terminal.

    git fetch origin
    git reset --hard origin/develop
    

    then switched to another branch, then came back to develop again.