Git revert local changes-How do I revert all local changes in Git managed project to previous state?

731    Asked by AbhinavPillai in Salesforce , Asked on Feb 22, 2021
Answered by Abhinav Pillai

To revert changes done to your working directory

git checkout .

To revert changes made to the index

git reset --hard

Warning: This will reset all unpushed commits to master.

To revert a change that you have committed

git revert

To remove untracked files

git clean -f

To remove untracked directories

git clean -fd



Your Answer

Interviews

Parent Categories