Search code examples
gitintellij-idea

Untracked files prevent checkout


In my project under IntelliJ I checkout branch with old version in order to seee how something was done there. I didn't change antyhing and now when I want to return to master I receive this message: Untracked files prevent checkout. Firstly there were only new webdriver file shown which was added to project in later version but now after executing command git status it shows all the class which were added in later version. What happend ? How can I skip it and return to master without breaking my project ?


Solution

  • If you don't have any changes that you want to keep for the old branch, you can force checkout to master.

    git checkout -f BRANCH-NAME

    Edit: I do not use IntelliJ so I can't advise for that. Open a terminal, navigate to your git project and run the above command.