re: Git Staging Area: Explained Like I'm Five VIEW POST

re: Clear explanation! Any five-year old could now get how git works! Also had a laugh in the process I am just a bit confused about "git revert" and ...

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?


Yes, very clear!

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

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.

code of conduct - report abuse