Instructor: In our project, we've just made a push to GitHub. If we do a git log oneline, we see that our HEAD is pointing to our local branch master, which is also where our origin master and origin HEAD are, which means our local branch is up to date with our origin.
Say we have this take three commit here where we edit this function and we want to change something about that. We will not use git reset here though, because we've already pushed this and someone else may have pulled it. If we reset, that means we're re-writing history and we don't want to do that once it's already pushed.
Instead, we are going to do a git revert. We can do a git revert. Here we want to give it the hash of the commit that we want to revert. That's this one right here. Let's revert this hash, and it brings up a text editor here and it wants us to make a revert commit.
This is like a merge commit, meaning it adds another commit to the tree, and we have to give it a message. Revert take three, that's a fine message. I'm going to hit :wq to save that.
Now, if I do a git log oneline, we can see that it has reverted take three. If I check out app.js, that function is gone. What happened is, between here and here, I added the function. The revert of that is to remove the function.
The really important thing here is that the history is still there. If we went back to this take three commit, we would get our function back. Crucially, anyone who's already pulled the origin/master branch will have a clean history tree because we used revert here instead of reset.
We can git push this, and now all of our collaborators will have this file empty, as well.