eclipsegit

Is there a way to change the project from git to the state when I first checked out? (didn't make any commit)


I imported a git project using "Clone URI" in Eclipse.

I made some changes on it. However, if I want to start from the original.

Instead of disconnecting from a repository, deleting files and folders, and re-importing the project.

Is there a way to keep the project same as a project in Git?

In this case, I don't know which terminology to use (revert, reset, rollback, re-checkout). Instead of importing a project again, I want to change my project to the time when I first checked out. I don't need to commit changes I made.

I'm not trying to undo the commit, nor do I try to restore any deleted file.


Solution

  • Since you did not commit any of the changes you made after cloning, you can just do git checkout -- .

    This will get rid of all your changes, and put your project back in the state it was when you cloned it.

    Steps:

    1. cd into your project folder
    2. Execute git checkout -- .