Post Image

Git Discard Uncommitted Changes

If you find yourself needing to throw all of your code additions or modifications and are using Git version control this task is very simple. Forget deleting all the lines of code you have modified and instead run the command below to bring you back to the most recent commit, discarding any changes that you have made.

 

$ git checkout .
Updated 1 path from the index
$

 

A word of warning, there is no confirmation and there is no way that I am aware of to get the changes back so make sure you are sure that this is what you want to do before you run the command.



Comments (0)
Leave a Comment