Code Editor

What if you decide to change the ghost's line in the working directory, but then decide you wanted to discard that change?

You could rewrite the line how it was originally, but what if you forgot the exact wording? The command

git checkout HEAD filename

will restore the file in your working directory to look exactly as it did when you last made a commit.

Here, filename again is he actual name of the file. If the file is named changes.txt, the command would be

git checkout HEAD changes.txt
Report a Bug
If you see a bug or any other issue with this page, please report it here.