Web Development

git reset —hard

git reset --hard allows you to remove all changes to local files. This is final.

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   vue-cart/index.html

no changes added to commit (use "git add" and/or "git commit -a")
$ git reset --hard
HEAD is now at b25f597 Creating a simple Cart
$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

git reset HEAD

git reset HEAD <file> allows you reset changes to the last commit. This is final.

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   vue-cart/main.js

no changes added to commit (use "git add" and/or "git commit -a")
$ git reset HEAD vue-cart/main.js 
Unstaged changes after reset:
M	vue-cart/main.js