Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (29.3k points)

Is there a git command to revert all uncommitted changes in a working tree and index and to also remove newly created files and folders?

1 Answer

0 votes
by (50.2k points)

For this problem, you can use these two commands

# To Revert changes to modified files.

git reset --hard

Reference: https://git-scm.com/docs/git-reset#Documentation/git-reset.txt---hard

# Remove all untracked files and directories. (`-f` is `force`, `-d` is `remove directories`)

git clean -fd

Refer: https://git-scm.com/docs/git-clean

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...