Praaveen Vr
praaveen
Published in
1 min readDec 13, 2021

--

Git reset -hard

The git reset command is for undoing changes. It has three primary forms of invocation. These forms correspond to command line arguments --soft, --mixed, --hard.

Git reset — hard will change head, index and working directory.
Git reset — soft will change head only. No change to index, working directory.
Git reset — mixed, which is the default, and keeps all files the same but unstages the changes. This is the most flexible option, but despite the name, it doesn’t modify files.

Here example is for hard reset and assuming the branch name as production

git log

Pick the commit id in the branch and reset to that id in local
git reset — hard fd5b0f3e5f3589238d56e70b43d640f238e157e6

Now force push that into remote repo or server, based on the your setup
git push origin production -f

Now other developers who want the reset changes of the branch can run the below line
git reset — hard origin/production

--

--