Little Git Tricks: Revert Changes in a File
If you want to revert a change in a file with Git, you can use this command:
The double-hyphen (--) tells Git to take what follows as its second argument (the path to the file). This makes it clear that you did not specify a branch.
While this works, it is not ideal. You might wonder what command to use or where the -- should go. It can be hard to remember and we often need to check the documentation to make sure we do it the right way. Is there a better way?
