Discuss your project
Shell

do a hard reset of a working copy in git

To revert to a clean working copy, you can delete all the files in your directory, leaving the hidden git files, and run the following command:git reset --hard origin/dev Precautions before executing the order This tutorial retains the command and the co...

do a hard reset of a working copy in git

To revert to a clean working copy, you can delete all the files in your directory, leaving the hidden git files, and run the following command:

git reset --hard origin/dev

Contrôles avant une opération de gestion de versions

Precautions before executing the order

This tutorial retains the command and the context of its publication. Before using it on a current repository, inspect the branch, the modified files, and the exact target:

git status --short
git log --oneline --decorate -5

Create a backup branch or tag when the operation rewrites history or deletes files. In particular, git reset --hard overwrites the changes in the working directory.

Reference: official documentation of git reset.

Share this article