git revert with git reset

Source: Internet
Author: User
Tags using git

git revert with git reset

Common denominator: The submitted code will be returned to staging area

Different points:

git revert: Undo an action, use a new commit to mark the old commit invalidation, that is, cancel the operation. There will be one commit committed in git log, one revocation commit

Git reset: Undo a commit, roll head back, or delete a new commit. No new commit in Git log

Note: When you continue with the previous version of merge in the future, because git revert is a reverse commit "in and" before, this change will not recur when you merge Old branch later.

Git reset removes certain commits from one branch, so the rollback commit should be introduced again when you merge with the old branch.

In the usual code, get used to reset. Avoid committing the operation by mistake, or accidentally using git revert, you can revoke the commit with git reset.

git revert with git reset

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.