Checkout & Reset
Checkout Commit
// Get commit hash
D:\work\emclas>git log --oneline -n 3
471f9f7 extra chunk call issue fix
9827818 blank worker call prevented
99e0156 chunkno -1 added
// checkout commit
git checkout 9827818
// make changes, but do not checkout to other branch elase changes would be lost
// to retain changes create new branch out of it
git checkout -b newbranch // now you can checkout to other and merge this to other branchOverrite file from remote
git checkout <hash> myfile.txt
git commit -m "msg" // git add not required in this case
// undo above change
git checkout HEAD myfile.txtRevert last commit
Hard reset ( dangerious )
Still untracked files remains in repo. to clean it use git clean -df
Clean
Often used with --hard reset
Undo ( reset files from repo)
Last updated
Was this helpful?