elvis
elvis

Reputation: 1188

How to delete all my unstaged changes with a single git command?

I'm using git for java projects and I did changes in many classes and I didn't do git add, git commit and push. And now I want to delete all my changes. How can I do that? Is there a git command because I don't want to delete all the code manually? Thank you!

Upvotes: 1

Views: 5192

Answers (3)

Ramazan
Ramazan

Reputation: 383

After

git stash git stash drop

all files added to "staged"

Upvotes: 1

Akrd Kmnc
Akrd Kmnc

Reputation: 112

If you want to use git command, so look at this.

Another suggestion is you can use program that make you easy to use git, like GitHub Desktop, VSCODE version control. That tools have functions that you can make it easy to manage your git project.

Upvotes: 0

michid
michid

Reputation: 10814

You can try

git checkout .

or

git stash
git stash drop

or (assuming you're on branch master)

git reset --hard master

Upvotes: 2

Related Questions