How to quickly cancel git local changes



In development, you need to undo file changes and restore to the last staged status, you can use git checkout to quickly restore the file

In the demo we restore the "test.txt" file to the state of the last add


git checkout src/test.txt


checkout : Switch branches or restore working tree files
Was this helpful?

I hope to help every developer quickly find the commands they need. Of course, you can also add your own commonly used commands for easy searching.