-1

Trying; File -> New -> Project from Version Control -> Git

gives me following error:

The directory <project-name> already exists. Please choose another directory.

My understanding was that it will ask for confirmation whether to overwrite or not. Is deleting the project from file system and importing again the only way?

RobC
  • 22,977
  • 20
  • 73
  • 80
  • Do I understand you correctly - you want to go back to a previous state of the code? – Psytho Jan 29 '18 at 09:34
  • Yes. I want to go back to previous state of code. –  Jan 29 '18 at 15:04
  • Using git you don't have to delte anything to achieve this. That is what git is for (among ohter things). Read the Kamen Minkov's answer how to do what you want. And read [git manual](https://git-scm.com/book/en/v2) too. – Psytho Jan 29 '18 at 15:06

1 Answers1

1

Git is simply saying that a directory with the name of the project you want to clone and import already exists. It's not asking for confirmation, it is simply refusing to clone it to the location of your choice. You have at least two options to deal with this:

  • Delete (or alternatively rename) the existing directory so that Git can clone the repo anew
  • Reset the repository so that it matches the remote, discarding your changes:

    git fetch origin
    git reset --hard origin/master
    

Link to a detailed answer by Dan Moulding.

Kamen Minkov
  • 3,324
  • 1
  • 14
  • 21
  • I have not played with git much. Hence I will go with first option. –  Jan 29 '18 at 15:08