The difference between git rebase and git merge

Source: Internet
Author: User

Original link: http://zires.info/tag/git-merge/

git merge is used to merge two branches.

# merge the B branches into the current branch
git merge B

git cherry-pick can choose one or several commits (s) in one branch to operate. For example, suppose we have a stable version of the branch, called V2.0, there is a development version of the Branch v3.0, we can not directly merge two branches, which will lead to stable version confusion, but also want to add a v3.0 in the function to v2.0, here can use Cherry-pick.

# first view the commit ID of the commit to merge in v3.0
git log
# Assuming it's a commit f79b0b1ffe445cab6e531260743fa4e08fb4048b

# cut into the v2.0
Git Check v2.0

# Merge Commit
Git Cherry-pick f79b0b1ffe445cab6e531260743fa4e08fb4048b

git rebase a bit like git merge, but the two are different, for example, you have two drawers A and B, there are clothes, now want to put the B in a, git merge is the kind of rampage, pick up B is poured into a inside, If the full (conflict) and then tidy up, and git rebase is very housekeeping, it will be a piece from B to a in addition, will be based on the time of the first put in the order to add, if full you can deal with this, you can continue to add, or skip this, or do not add, a restore. So merge fits that trivial, simple merge, system-level merge or rebase.

Professional differences Please come here. Merging and diffraction

# Merge B
git rebase b

# The conflict continues to merge after processing
Git rebase--continue

# Skip Over
Git rebase--skip

# Cancel Merge
Git rebase--abort

The difference between git rebase and git merge

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.