Difference between git checkout [commit] and git checkout [commit] file -


here both listed changing working directory(wd).

https://git-scm.com/book/en/v2/git-tools-reset-demystified

however 1 wd safe(git co commit) , 1 unsafe.

can explain giving example?

git checkout take repo state head . considered safe not lose work . can come normal state doing git checkout master or .

but git checkout file , erase changes made on file , take file last commit state . lose work , not recoverable . considered unsafe .

you use git stash command keep changes , take code head state , recoverable .


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -