DEV Community

Discussion on: Git Staging Area: Explained Like I'm Five

Collapse
 
offendingcommit profile image
Jonathan Irvin

A git revert will create another commit that is an exact mirror opposite of the commit you are reverting.

In my example, a sealed box is a commit. If you have a commit where you add 2 lines and remove one. The reverted commit will remove 2 lines and add one, effectively nullifying your original change.

This is why I was making the juxtaposition to anti-matter where a commit and a reverted commit combined would be the same as no commit.

Does that make sense?

Collapse
 
kostassar profile image
Kostas Sar

Yes, very clear!

But do we have to commit this new anti-box? Or is it pushed automatically?

Thread Thread
 
offendingcommit profile image
Jonathan Irvin

Whenever you perform a git revert the commit is created automagically for you. You can see it if you perform a git log or use a Git GUI like Sourcetree.

IF you want to make your revert public, you would do a git push and your local repo would be synced with the remote repo, assuming no conflicts with the public repo are present.

Thread Thread
 
kostassar profile image
Kostas Sar

Thank you!