git reset --hard
(sets pointer to the head)
git reset --hard n
git reset --hard <commit-hash>
-
create a new branch
git checkout -b new-branch
-
add the local changes
git add .
-
commit the changes to the new branch
git commit -m "added local changes to the new branch"
-
switch to original branch
git checkout old-branch
-
clean the local changes so that only commit changes remain
git clean -f