I have React project in IntelliJ and GitHub. I found that I forgot to add /.idea folder into the .gitignore file. Here is what I did:
I add
/.idea
to the .gitignore file, and rungit add .
,git commit -m 'add gitignore'
, andgit push origin master
.After pushed the changes again. I found that the /.idea folder was still on the GitHub, so I manually deleted the /.idea folder on GitHub.
Because I wanted to make sure every synchronized between my local and GitHub, I ran
git pull
. After running the command, everything in my local IntelliJ disappeared...
However, I go to the file explorer, everything is still in the folder.
Why is everything in my IntelliJ disappeared?
How can I re-import my project into the IntelliJ?
CodePudding user response:
First of all, just re-import the intellij project. To be precise, you can use import from existing sources. Why it disappeared? Cause you deleted the .idea folder. What is the .idea folder?
Second, about the steps you have made. Gitignore is for the purpose to do not track specific files. If the file is already in the repository, then adding it to the gitignore will never delete it. Next time, please refer to Remove a file from a Git repository without deleting it from the local filesystem