So I got run into a situation where I modified multiple files and some of them are unnecessary to be committed along with the other files modification. So for example , I have a file named “plugins/sc-todos/templates/singlesmart_todo.php” which is a unnecessary modification with other modified files that I am about to commit into my branch.
So this could be one of the ways that can be done in Git in order to undo or revert a certain file from the original version of our branch. So below I run the following git command checkout with double dash and the filename that I don’t want to include into my commit.
>>git checkout — plugins/sc-todos/templates/singlesmart_todo.php
So as you can see, when I run the git command status, the file plugins/sc-todos/templates/singlesmart_todo.php is no longer in the list of modified files and if you check the file it is reverted back to your current branch version.
Feel free to leave some comments! Have a great day!